Commit 1da8f18c authored by chris's avatar chris

Re-enable minute selection

parent 944b9ebe
......@@ -6,7 +6,7 @@ from datetimewidget.widgets import DateTimeWidget
dateTimeOptions = {
'weekStart': '1',
'minView': '1',
'minView': '0',
'minuteStep': '15',
'startDate': datetime.today().date(),
'todayHighlight': 'true',
......@@ -19,16 +19,12 @@ class UserProfileForm(forms.ModelForm):
fields = ('email_notifications',)
class DateTimeWidgetFixed(DateTimeWidget):
'''a hack for 1. returning a string and 2. returning a
fixed hour value (xx:00:00)'''
def __init__(self, **kwargs):
super(DateTimeWidgetFixed, self).__init__(**kwargs)
def value_from_datadict(self, data, files, name):
a = str(super(
DateTimeWidgetFixed, self).value_from_datadict(data, files, name))
a = ''.join(a.split(':')[0]) + ':00:00'
return a
......
......@@ -77,11 +77,11 @@ def editchoices(request, poll_id):
for choice in Choice.objects.filter(poll=poll.id)]
for v in votes:
v.save()
poll.save()
if request.user.is_anonymous(): # Anonymous has voted...
key = 'has_voted-' + poll.id
request.session[key] = True # This writes cookie
request.session['name'] = voter # This writes cookie
poll.save()
return HttpResponseRedirect(reverse('meetingpoll', args=(str(poll.id),)))
else:
......@@ -217,18 +217,19 @@ def vote(request, poll_id):
old.comment = vorm.cleaned_data['comment']
old.save()
is_updated = True
poll.save()
if has_voted:
messages.success(request, _("Your vote has been counted, thank you."))
if is_updated:
messages.success(request, _("Your vote has been updated, thank you."))
if has_voted and poll.user:
try:
if poll.user.userprofile.email_notifications:
email_notify(poll, voter)
except:
pass
if has_voted or is_updated:
messages.success(request, _("Your vote has been counted, thank you."))
poll.save()
return HttpResponseRedirect(reverse('vote', args=(poll_id,)))
else:
messages.error(request, _('Did you forget to provide your name?'))
voter = _('your name')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment