Commit 83de328e authored by Christophe Siraut's avatar Christophe Siraut
Browse files

Always return fixed hours.

parent 25fbedbd
from django import forms
from .models import UserProfile, Poll, Choice, Bulletin, Vote
from django.utils.translation import ugettext_lazy as _
from datetimewidget.widgets import DateTimeWidget
from datetime import datetime, timedelta
from datetimewidget.widgets import DateTimeWidget
dateTimeOptions = {
'weekStart': '1',
#'minView': '1',
'minView': '1',
'minuteStep': '15',
'todayHighlight': 'true'
'todayHighlight': 'true',
......@@ -19,12 +19,17 @@ 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):
return str(super(
a = str(super(
DateTimeWidgetFixed, self).value_from_datadict(data, files, name))
a = ''.join(a.split(':')[0]) + ':00:00'
return a
class PollForm(forms.ModelForm):
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