Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
6aa5382c
Commit
6aa5382c
authored
Oct 21, 2016
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix frontend events form
parent
46257732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
website/events/forms.py
website/events/forms.py
+5
-4
website/events/models.py
website/events/models.py
+2
-1
website/events/views.py
website/events/views.py
+7
-1
No files found.
website/events/forms.py
View file @
6aa5382c
from
django
import
forms
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
get_language
,
ugettext_lazy
as
_
from
.models
import
RegistrationInformationField
class
RegistrationInformationFieldForm
(
forms
.
ModelForm
):
order
=
forms
.
IntegerField
(
label
=
_
(
'order'
),
initial
=
0
)
class
Meta
:
...
...
@@ -36,8 +35,10 @@ class FieldsForm(forms.Form):
elif
field
.
type
==
RegistrationInformationField
.
TEXT_FIELD
:
self
.
fields
[
key
]
=
forms
.
CharField
()
self
.
fields
[
key
].
label
=
field
.
name
self
.
fields
[
key
].
help_text
=
field
.
description
self
.
fields
[
key
].
label
=
getattr
(
field
,
'{}_{}'
.
format
(
'name'
,
get_language
()))
self
.
fields
[
key
].
help_text
=
getattr
(
field
,
'{}_{}'
.
format
(
'description'
,
get_language
()))
self
.
fields
[
key
].
initial
=
information_field
[
'value'
]
if
not
field
.
type
==
RegistrationInformationField
.
BOOLEAN_FIELD
:
self
.
fields
[
key
].
required
=
field
.
required
...
...
website/events/models.py
View file @
6aa5382c
...
...
@@ -118,7 +118,8 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
return
self
.
registrationinformationfield_set
.
count
()
>
0
def
reached_participants_limit
(
self
):
return
self
.
max_participants
<=
self
.
registration_set
.
count
()
return
(
self
.
max_participants
is
not
None
and
self
.
max_participants
<=
self
.
registration_set
.
count
())
@
property
def
status
(
self
):
...
...
website/events/views.py
View file @
6aa5382c
...
...
@@ -12,7 +12,7 @@ from django.utils import timezone
from
django.utils.text
import
slugify
from
django.utils.translation
import
ugettext_lazy
as
_
,
pgettext_lazy
from
.models
import
Event
,
Registration
from
.models
import
Event
,
Registration
,
RegistrationInformationField
from
.forms
import
FieldsForm
...
...
@@ -240,6 +240,12 @@ def registration(request, event_id, action=None):
obj
.
save
()
form_field_values
=
form
.
field_values
()
for
field
in
form_field_values
:
import
pdb
pdb
.
set_trace
()
if
(
field
[
'field'
].
type
==
RegistrationInformationField
.
INTEGER_FIELD
and
field
[
'value'
]
is
None
):
field
[
'value'
]
=
0
field
[
'field'
].
set_value_for
(
obj
,
field
[
'value'
])
else
:
...
...
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