Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pretix public registrations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
Pretix public registrations
Commits
0de34be1
Commit
0de34be1
authored
5 years ago
by
Felix Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
Break up a few too long lines
parent
5e956fbe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pretix_public_registrations/signals.py
+19
-8
19 additions, 8 deletions
pretix_public_registrations/signals.py
with
19 additions
and
8 deletions
pretix_public_registrations/signals.py
+
19
−
8
View file @
0de34be1
...
@@ -4,7 +4,9 @@ from django.template.loader import get_template
...
@@ -4,7 +4,9 @@ from django.template.loader import get_template
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.urls
import
resolve
,
reverse
from
django.urls
import
resolve
,
reverse
from
django_gravatar.helpers
import
get_gravatar_url
from
django_gravatar.helpers
import
get_gravatar_url
from
pretix.presale.signals
import
question_form_fields
,
front_page_bottom
,
process_response
,
html_head
from
pretix.presale.signals
import
(
question_form_fields
,
front_page_bottom
,
process_response
,
html_head
)
from
pretix.control.signals
import
nav_event_settings
from
pretix.control.signals
import
nav_event_settings
from
pretix.base.models
import
OrderPosition
,
QuestionAnswer
from
pretix.base.models
import
OrderPosition
,
QuestionAnswer
from
pretix.base.settings
import
settings_hierarkey
from
pretix.base.settings
import
settings_hierarkey
...
@@ -33,7 +35,9 @@ def add_public_registrations_html_head(sender, request=None, **kwargs):
...
@@ -33,7 +35,9 @@ def add_public_registrations_html_head(sender, request=None, **kwargs):
@receiver
(
question_form_fields
,
dispatch_uid
=
"
public_registration_question
"
)
@receiver
(
question_form_fields
,
dispatch_uid
=
"
public_registration_question
"
)
def
add_public_registration_question
(
sender
,
position
,
**
kwargs
):
def
add_public_registration_question
(
sender
,
position
,
**
kwargs
):
if
str
(
position
.
item
.
pk
)
in
sender
.
settings
.
get
(
'
public_registrations_items
'
):
if
str
(
position
.
item
.
pk
)
in
sender
.
settings
.
get
(
'
public_registrations_items
'
):
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
))
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
)
)
headers
=
(
headers
=
(
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
)
+
(
)
+
(
...
@@ -55,12 +59,14 @@ def add_public_registration_question(sender, position, **kwargs):
...
@@ -55,12 +59,14 @@ def add_public_registration_question(sender, position, **kwargs):
@receiver
(
signal
=
front_page_bottom
,
dispatch_uid
=
"
public_registrations_table
"
)
@receiver
(
signal
=
front_page_bottom
,
dispatch_uid
=
"
public_registrations_table
"
)
def
add_public_registrations_table
(
sender
,
**
kwargs
):
def
add_public_registrations_table
(
sender
,
**
kwargs
):
if
not
sender
.
settings
.
get
(
'
public_registrations_items
'
)
and
not
(
if
not
sender
.
settings
.
get
(
'
public_registrations_items
'
)
and
not
(
sender
.
settings
.
get
(
'
public_registrations_questions
'
)
sender
.
settings
.
get
(
'
public_registrations_questions
'
)
and
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
and
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
and
sender
.
settings
.
get
(
'
public_registrations_show_attendee_name
'
)
and
sender
.
settings
.
get
(
'
public_registrations_show_attendee_name
'
)
):
):
return
""
return
""
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
))
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
)
)
headers
=
(
headers
=
(
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
)
+
(
)
+
(
...
@@ -68,12 +74,17 @@ def add_public_registrations_table(sender, **kwargs):
...
@@ -68,12 +74,17 @@ def add_public_registrations_table(sender, **kwargs):
)
+
[
)
+
[
q
.
question
for
q
in
public_questions
q
.
question
for
q
in
public_questions
]
]
order_positions
=
OrderPosition
.
objects
.
filter
(
order__event
=
sender
,
item__pk__in
=
sender
.
settings
.
get
(
'
public_registrations_items
'
))
order_positions
=
OrderPosition
.
objects
.
filter
(
order__event
=
sender
,
item__pk__in
=
sender
.
settings
.
get
(
'
public_registrations_items
'
)
)
public_order_positions
=
[
public_order_positions
=
[
op
for
op
in
order_positions
op
for
op
in
order_positions
if
op
.
meta_info_data
.
get
(
'
question_form_data
'
,
{}).
get
(
'
public_registrations_public_registration
'
)
if
op
.
meta_info_data
.
get
(
'
question_form_data
'
,
{}).
get
(
'
public_registrations_public_registration
'
)
]
]
answers
=
QuestionAnswer
.
objects
.
filter
(
orderposition__in
=
public_order_positions
,
question__in
=
public_questions
)
answers
=
QuestionAnswer
.
objects
.
filter
(
orderposition__in
=
public_order_positions
,
question__in
=
public_questions
)
public_answers
=
{
public_answers
=
{
(
a
.
orderposition_id
,
a
.
question_id
):
a
(
a
.
orderposition_id
,
a
.
question_id
):
a
for
a
in
answers
for
a
in
answers
...
...
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