Poll create service
Services related to poll creation.
PollCreateService
Services related to CRUD operation on Polls
Source code in apps/polls_management/services/poll_create_service.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
create_or_edit_poll(poll_form, options, user)
staticmethod
Create a new poll starting from a PollForm object (or apply the edits on the existing object)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
poll_form |
PollForm
|
form containing data of object you wanna create. |
required |
options |
List[str]
|
list of all options (as strings). They must be at least 2 and at most 10. |
required |
Raises:
| Type | Description |
|---|---|
MissingNameOrQuestionExcetion
|
your form has not all required data. |
TooFewOptionsExcetion
|
you put in too few options for this type of poll. |
TooManyOptionsExcetion
|
you put in too many options for this type of poll. |
Returns:
| Name | Type | Description |
|---|---|---|
poll |
PollModel
|
the initialized and saved PollModel object |
Source code in apps/polls_management/services/poll_create_service.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |