Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Paweljong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
AlekSIS-App-Paweljong
Commits
9113fe22
Commit
9113fe22
authored
3 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Invalidate voucher and fix creation of user and person
parent
843abf64
No related branches found
No related tags found
1 merge request
!1
Reformat and cleanup
Pipeline
#55884
failed
3 years ago
Stage: prepare
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/paweljong/forms.py
+15
-3
15 additions, 3 deletions
aleksis/apps/paweljong/forms.py
aleksis/apps/paweljong/views.py
+22
-25
22 additions, 25 deletions
aleksis/apps/paweljong/views.py
with
37 additions
and
28 deletions
aleksis/apps/paweljong/forms.py
+
15
−
3
View file @
9113fe22
...
@@ -256,7 +256,7 @@ class RegisterEventContactDetails(ExtensibleForm):
...
@@ -256,7 +256,7 @@ class RegisterEventContactDetails(ExtensibleForm):
Fieldset
(
Fieldset
(
_
(
"
Personal data
"
),
_
(
"
Personal data
"
),
Row
(
"
first_name
"
,
"
additional_name
"
,
"
last_name
"
),
Row
(
"
first_name
"
,
"
additional_name
"
,
"
last_name
"
),
Row
(
"
date_of_birth
"
,
"
sex
"
),
Row
(
"
date_of_birth
"
,
"
place_of_birth
"
,
"
sex
"
),
),
),
Fieldset
(
Fieldset
(
_
(
"
Address data
"
),
_
(
"
Address data
"
),
...
@@ -265,7 +265,7 @@ class RegisterEventContactDetails(ExtensibleForm):
...
@@ -265,7 +265,7 @@ class RegisterEventContactDetails(ExtensibleForm):
),
),
Fieldset
(
Fieldset
(
_
(
"
Contact details
"
),
_
(
"
Contact details
"
),
Row
(
"
mobile_number
"
,
"
email
"
),
Row
(
"
mobile_number
"
,
"
phone_number
"
,
"
email
"
),
),
),
Fieldset
(
Fieldset
(
_
(
"
School details
"
),
_
(
"
School details
"
),
...
@@ -282,6 +282,7 @@ class RegisterEventContactDetails(ExtensibleForm):
...
@@ -282,6 +282,7 @@ class RegisterEventContactDetails(ExtensibleForm):
label
=
_
(
"
Additional names
"
),
label
=
_
(
"
Additional names
"
),
help_text
=
_
(
"
Please enter any additional names.
"
),
help_text
=
_
(
"
Please enter any additional names.
"
),
required
=
False
,
required
=
False
,
disabled
=
True
,
)
)
last_name
=
forms
.
CharField
(
last_name
=
forms
.
CharField
(
...
@@ -315,10 +316,20 @@ class RegisterEventContactDetails(ExtensibleForm):
...
@@ -315,10 +316,20 @@ class RegisterEventContactDetails(ExtensibleForm):
),
),
)
)
phone_number
=
PhoneNumberField
(
label
=
_
(
"
Phone number
"
),
required
=
False
,
)
date_of_birth
=
forms
.
DateField
(
date_of_birth
=
forms
.
DateField
(
label
=
_
(
"
Date of birth
"
),
label
=
_
(
"
Date of birth
"
),
)
)
place_of_birth
=
forms
.
CharField
(
label
=
_
(
"
Place of birth
"
),
required
=
False
,
)
sex
=
forms
.
ChoiceField
(
sex
=
forms
.
ChoiceField
(
label
=
_
(
"
Sex
"
),
label
=
_
(
"
Sex
"
),
help_text
=
_
(
help_text
=
_
(
...
@@ -378,7 +389,8 @@ class RegisterEventAdditional(ExtensibleForm):
...
@@ -378,7 +389,8 @@ class RegisterEventAdditional(ExtensibleForm):
for
field
in
event
.
linked_group
.
additional_fields
.
all
():
for
field
in
event
.
linked_group
.
additional_fields
.
all
():
field_instance
=
getattr
(
fields
,
field
.
field_type
)(
field_instance
=
getattr
(
fields
,
field
.
field_type
)(
required
=
False
,
required
=
field
.
required
,
help_text
=
field
.
help_text
,
)
)
self
.
fields
[
field
.
title
]
=
field_instance
self
.
fields
[
field
.
title
]
=
field_instance
node
=
Fieldset
(
f
"
{
field
.
title
}
"
,
f
"
{
field
.
title
}
"
)
node
=
Fieldset
(
f
"
{
field
.
title
}
"
,
f
"
{
field
.
title
}
"
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/paweljong/views.py
+
22
−
25
View file @
9113fe22
...
@@ -495,7 +495,7 @@ class RegisterEventWizardView(SessionWizardView):
...
@@ -495,7 +495,7 @@ class RegisterEventWizardView(SessionWizardView):
event
=
Event
.
objects
.
get
(
id
=
self
.
kwargs
[
"
pk
"
])
event
=
Event
.
objects
.
get
(
id
=
self
.
kwargs
[
"
pk
"
])
cleaned_data_email
=
self
.
get_cleaned_data_for_step
(
"
email
"
)
cleaned_data_email
=
self
.
get_cleaned_data_for_step
(
"
email
"
)
cleaned_data_contact_details
=
self
.
get_cleaned_data_for_step
(
"
cotact_details
"
)
cleaned_data_contact_details
=
self
.
get_cleaned_data_for_step
(
"
co
n
tact_details
"
)
cleaned_data_guardians
=
self
.
get_cleaned_data_for_step
(
"
guardians
"
)
cleaned_data_guardians
=
self
.
get_cleaned_data_for_step
(
"
guardians
"
)
cleaned_data_register
=
self
.
get_cleaned_data_for_step
(
"
register
"
)
cleaned_data_register
=
self
.
get_cleaned_data_for_step
(
"
register
"
)
cleaned_data_additional
=
self
.
get_cleaned_data_for_step
(
"
additional
"
)
cleaned_data_additional
=
self
.
get_cleaned_data_for_step
(
"
additional
"
)
...
@@ -517,33 +517,26 @@ class RegisterEventWizardView(SessionWizardView):
...
@@ -517,33 +517,26 @@ class RegisterEventWizardView(SessionWizardView):
)
)
user
.
set_password
(
cleaned_data_register
[
"
password1
"
])
user
.
set_password
(
cleaned_data_register
[
"
password1
"
])
user
.
save
()
user
.
save
()
else
:
# Create Person
user
=
self
.
request
.
user
person
=
Person
.
objects
.
create
(
user
=
user
,
person
=
Person
.
objects
.
get_or_create
(
email
=
cleaned_data_contact_details
[
"
email
"
],
user
=
user
,
short_name
=
cleaned_data_contact_details
[
"
short_name
"
],
defaults
=
{
first_name
=
cleaned_data_contact_details
[
"
first_name
"
],
"
email
"
:
cleaned_data_contact_details
[
"
email
"
],
additional_name
=
cleaned_data_contact_details
[
"
additional_name
"
],
"
first_name
"
:
cleaned_data_contact_details
[
"
first_name
"
],
last_name
=
cleaned_data_contact_details
[
"
last_name
"
],
"
additional_name
"
:
cleaned_data_contact_details
[
"
additional_name
"
],
street
=
cleaned_data_contact_details
[
"
street
"
],
"
last_name
"
:
cleaned_data_contact_details
[
"
last_name
"
],
housenumber
=
cleaned_data_contact_details
[
"
housenumber
"
],
"
phone_number
"
:
cleaned_data_contact_details
[
"
phone_number
"
],
postal_code
=
cleaned_data_contact_details
[
"
postal_code
"
],
"
place_of_birth
"
:
cleaned_data_contact_details
[
"
place_of_birth
"
],
place
=
cleaned_data_contact_details
[
"
place
"
],
}
mobile_number
=
cleaned_data_contact_details
[
"
mobile_number
"
],
)
phone_number
=
cleaned_data_contact_details
[
"
phone_number
"
],
date_of_birth
=
cleaned_data_contact_details
[
"
date_of_birth
"
],
place_of_birth
=
cleaned_data_contact_details
[
"
place_of_birth
"
],
sex
=
cleaned_data_contact_details
[
"
sex
"
],
photo
=
cleaned_data_contact_details
[
"
photo
"
],
description
=
cleaned_data_contact_details
[
"
description
"
],
)
if
(
if
(
"
school
"
in
cleaned_data_contact_details
"
school
"
in
cleaned_data_contact_details
or
"
school_class
"
in
cleaned_data_contact_details
or
"
school_class
"
in
cleaned_data_contact_details
or
"
school_place
"
in
cleaned_data_contact_details
or
"
school_place
"
in
cleaned_data_contact_details
or
"
mobile
"
in
cleaned_data_contact_details
or
"
mobile
_number
"
in
cleaned_data_contact_details
or
"
sex
"
in
cleaned_data_contact_details
or
"
sex
"
in
cleaned_data_contact_details
or
"
date_of_birth
"
in
cleaned_data_contact_details
or
"
date_of_birth
"
in
cleaned_data_contact_details
):
):
...
@@ -567,6 +560,7 @@ class RegisterEventWizardView(SessionWizardView):
...
@@ -567,6 +560,7 @@ class RegisterEventWizardView(SessionWizardView):
person
.
street
=
cleaned_data_contact_details
[
"
street
"
]
person
.
street
=
cleaned_data_contact_details
[
"
street
"
]
person
.
postal_code
=
cleaned_data_contact_details
[
"
postal_code
"
]
person
.
postal_code
=
cleaned_data_contact_details
[
"
postal_code
"
]
person
.
place
=
cleaned_data_contact_details
[
"
place
"
]
person
.
place
=
cleaned_data_contact_details
[
"
place
"
]
person
.
housenumber
=
cleaned_data_contact_details
[
"
housenumber
"
],
person
.
save
()
person
.
save
()
...
@@ -615,10 +609,13 @@ class RegisterEventWizardView(SessionWizardView):
...
@@ -615,10 +609,13 @@ class RegisterEventWizardView(SessionWizardView):
registration
.
save
()
registration
.
save
()
if
cleaned_data_financial
[
"
voucher_code
"
]
!=
""
:
if
cleaned_data_financial
[
"
voucher_code
"
]
!=
""
:
voucher
=
Voucher
.
objects
.
get
(
code
=
cleaned_data_financial
[
"
voucher_code
"
])
vouchers
=
Voucher
.
objects
.
filter
(
person
=
person
,
event
=
event
,
used
=
False
,
code
=
cleaned_data_financial
[
"
voucher_code
"
])
if
voucher
:
if
vouchers
:
voucher
=
vouchers
.
first
()
registration
.
voucher
=
voucher
registration
.
voucher
=
voucher
voucher
.
used
=
True
with
reversion
.
create_revision
():
with
reversion
.
create_revision
():
voucher
.
save
()
registration
.
save
()
registration
.
save
()
else
:
else
:
messages
.
error
(
self
.
request
,
_
(
"
You entered an invalid voucher code!
"
))
messages
.
error
(
self
.
request
,
_
(
"
You entered an invalid voucher code!
"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment