Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
afa9bd87
Verified
Commit
afa9bd87
authored
Apr 26, 2018
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Poster form
parent
0cc37070
Pipeline
#1479
passed with stage
in 12 minutes and 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
com/views.py
com/views.py
+13
-2
No files found.
com/views.py
View file @
afa9bd87
...
...
@@ -58,7 +58,6 @@ class PosterForm(forms.ModelForm):
fields
=
[
'name'
,
'file'
,
'club'
,
'screens'
,
'date_begin'
,
'date_end'
,
'display_time'
]
widgets
=
{
'screens'
:
forms
.
CheckboxSelectMultiple
,
'is_moderated'
:
forms
.
HiddenInput
()
}
date_begin
=
forms
.
DateTimeField
([
'%Y-%m-%d %H:%M:%S'
],
label
=
_
(
"Start date"
),
...
...
@@ -72,7 +71,7 @@ class PosterForm(forms.ModelForm):
if
self
.
user
:
if
not
self
.
user
.
is_com_admin
:
self
.
fields
[
'club'
].
queryset
=
Club
.
objects
.
filter
(
id__in
=
self
.
user
.
clubs_with_rights
)
self
.
fields
[
'display_time'
].
widget
=
forms
.
HiddenInput
(
)
self
.
fields
.
pop
(
'display_time'
)
class
ComTabsMixin
(
TabedViewMixin
):
...
...
@@ -572,6 +571,18 @@ class PosterEditBaseView(UpdateView):
form_class
=
PosterForm
template_name
=
'com/poster_edit.jinja'
def
get_initial
(
self
):
init
=
{}
try
:
init
[
'date_begin'
]
=
self
.
object
.
date_begin
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
except
Exception
:
pass
try
:
init
[
'date_end'
]
=
self
.
object
.
date_end
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
except
Exception
:
pass
return
init
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
if
'club_id'
in
kwargs
and
kwargs
[
'club_id'
]:
try
:
...
...
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