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
1c13e7fd
Commit
1c13e7fd
authored
3 months ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Plain Diff
Merge branch '68-skip-payment-step-when-costs-are-0-for-an-event' into 'master'
Resolve "Skip payment step when costs are 0 for an event" Closes
#68
See merge request
!70
parents
b8fdf82b
090cd0a9
No related branches found
No related tags found
1 merge request
!70
Resolve "Skip payment step when costs are 0 for an event"
Pipeline
#194054
passed
3 months ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/paweljong/urls.py
+1
-0
1 addition, 0 deletions
aleksis/apps/paweljong/urls.py
aleksis/apps/paweljong/views.py
+37
-33
37 additions, 33 deletions
aleksis/apps/paweljong/views.py
with
38 additions
and
33 deletions
aleksis/apps/paweljong/urls.py
+
1
−
0
View file @
1c13e7fd
...
...
@@ -24,6 +24,7 @@ register_forms = [
condition_dict
=
{
"
email
"
:
views
.
is_email_needed
,
"
register
"
:
views
.
is_person_anonymous
,
"
financial
"
:
views
.
is_financial_needed
,
}
account_forms
=
[
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/paweljong/views.py
+
37
−
33
View file @
1c13e7fd
...
...
@@ -285,6 +285,9 @@ def set_email_needed(request, slug: Optional[str] = None):
def
is_email_needed
(
wizard
):
return
wizard
.
request
.
session
.
get
(
"
email_needed
"
,
None
)
def
is_financial_needed
(
wizard
):
return
wizard
.
request
.
session
.
get
(
"
financial_needed
"
,
None
)
TEMPLATES
=
{
"
email
"
:
"
paweljong/event/register_wizard.html
"
,
...
...
@@ -407,7 +410,10 @@ class RegisterEventWizardView(SessionWizardView):
def
get_context_data
(
self
,
form
,
**
kwargs
):
context
=
super
().
get_context_data
(
form
,
**
kwargs
)
context
[
"
event
"
]
=
Event
.
objects
.
get
(
slug
=
self
.
kwargs
[
"
slug
"
])
event
=
Event
.
objects
.
get
(
slug
=
self
.
kwargs
[
"
slug
"
])
context
[
"
event
"
]
=
event
self
.
request
.
session
[
"
financial_needed
"
]
=
event
.
cost
>
0
if
self
.
steps
.
current
==
"
email
"
:
context
[
"
info_title
"
]
=
_
(
"
Create e-mail address
"
)
...
...
@@ -560,21 +566,15 @@ class RegisterEventWizardView(SessionWizardView):
except
KeyError
:
# FIXME
cleaned_data_register
=
False
cleaned_data_additional
=
self
.
get_cleaned_data_for_step
(
"
additional
"
)
cleaned_data_financial
=
self
.
get_cleaned_data_for_step
(
"
financial
"
)
cleaned_data_consent
=
self
.
get_cleaned_data_for_step
(
"
consent
"
)
if
cleaned_data_financial
[
"
voucher_code
"
]:
if
getattr
(
self
.
request
.
user
,
"
person
"
,
None
):
vouchers
=
Voucher
.
objects
.
filter
(
person
=
self
.
request
.
user
.
person
,
event
=
event
,
used
=
False
,
code
=
cleaned_data_financial
[
"
voucher_code
"
],
)
if
vouchers
:
voucher
=
vouchers
.
first
()
else
:
messages
.
error
(
self
.
request
,
_
(
"
You entered an invalid voucher code!
"
))
donation
=
0
if
is_financial_needed
(
self
):
cleaned_data_financial
=
self
.
get_cleaned_data_for_step
(
"
financial
"
)
donation
=
cleaned_data_financial
[
"
donation
"
]
cleaned_data_consent
=
self
.
get_cleaned_data_for_step
(
"
consent
"
)
# Create email address
if
cleaned_data_email
:
...
...
@@ -653,7 +653,7 @@ class RegisterEventWizardView(SessionWizardView):
event
=
event
,
person
=
person
,
medical_information
=
cleaned_data_additional
[
"
medical_information
"
],
donation
=
cleaned_data_financial
[
"
donation
"
]
,
donation
=
donation
,
school
=
cleaned_data_contact_details
[
"
school
"
],
school_class
=
cleaned_data_contact_details
[
"
school_class
"
],
school_place
=
cleaned_data_contact_details
[
"
school_place
"
],
...
...
@@ -672,23 +672,24 @@ class RegisterEventWizardView(SessionWizardView):
registration
.
save
()
if
cleaned_data_financial
[
"
voucher_code
"
]:
vouchers
=
Voucher
.
objects
.
filter
(
person
=
person
,
event
=
event
,
used
=
False
,
code
=
cleaned_data_financial
[
"
voucher_code
"
]
)
if
vouchers
:
voucher
=
vouchers
.
first
()
registration
.
voucher
=
voucher
voucher
.
used
=
True
with
reversion
.
create_revision
():
voucher
.
save
()
registration
.
save
()
else
:
messages
.
error
(
self
.
request
,
_
(
"
You entered an invalid voucher code!
"
))
if
is_financial_needed
(
self
):
if
cleaned_data_financial
[
"
voucher_code
"
]:
vouchers
=
Voucher
.
objects
.
filter
(
person
=
person
,
event
=
event
,
used
=
False
,
code
=
cleaned_data_financial
[
"
voucher_code
"
]
)
if
vouchers
:
voucher
=
vouchers
.
first
()
registration
.
voucher
=
voucher
voucher
.
used
=
True
with
reversion
.
create_revision
():
voucher
.
save
()
registration
.
save
()
else
:
messages
.
error
(
self
.
request
,
_
(
"
You entered an invalid voucher code!
"
))
invoice
=
registration
.
get_invoice
()
invoice
.
variant
=
cleaned_data_financial
[
"
payment_method
"
]
invoice
.
save
()
invoice
=
registration
.
get_invoice
()
invoice
.
variant
=
cleaned_data_financial
[
"
payment_method
"
]
invoice
.
save
()
context
=
{}
context
[
"
registration
"
]
=
registration
...
...
@@ -723,7 +724,10 @@ class RegisterEventWizardView(SessionWizardView):
user
=
person
,
)
return
redirect
(
"
do_payment
"
,
invoice
.
token
)
if
is_financial_needed
(
self
):
return
redirect
(
"
do_payment
"
,
invoice
.
token
)
else
:
return
redirect
(
"
vue_app
"
)
class
EventFullView
(
PermissionRequiredMixin
,
DetailView
):
...
...
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