Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
etch
nuages
Commits
83de328e
Commit
83de328e
authored
Aug 12, 2014
by
Christophe Siraut
Browse files
Always return fixed hours.
parent
25fbedbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
meetingpoll/forms.py
View file @
83de328e
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'
,
'startDate'
:
datetime
.
today
().
date
(),
'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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment