diff options
Diffstat (limited to 'webapp/polls/views.py')
-rw-r--r-- | webapp/polls/views.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/webapp/polls/views.py b/webapp/polls/views.py index 60ba025..21882ab 100644 --- a/webapp/polls/views.py +++ b/webapp/polls/views.py @@ -86,11 +86,16 @@ class PollFormView(FormView): raise Http404() poll = Poll(form.data) if form.is_bound else poll + pollster_id = None + if hasattr(poll.pollster, 'id'): + pollster_id = str(poll.pollster.id) + else: + pollster_id = poll.pollster context.update({ "poll": poll, "STATUS_CHOICES": Poll.status_choices(), - "POLLSTER_CHOICES": [('', '-')] + [ - (p.id, p.username) for p in Pollster.all()] + "POLLSTER_CHOICES": form.fields['pollster'].choices, + "pollster_id": pollster_id }) return context |