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
36ca2426
Commit
36ca2426
authored
5 years ago
by
Felix Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
Smarter and lesser DB usage
parent
1d31e165
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
+8
-12
8 additions, 12 deletions
pretix_public_registrations/signals.py
with
8 additions
and
12 deletions
pretix_public_registrations/signals.py
+
8
−
12
View file @
36ca2426
...
@@ -7,7 +7,7 @@ from django_gravatar.helpers import get_gravatar_url
...
@@ -7,7 +7,7 @@ from django_gravatar.helpers import get_gravatar_url
from
i18nfield.strings
import
LazyI18nString
from
i18nfield.strings
import
LazyI18nString
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
from
pretix.base.models
import
OrderPosition
,
QuestionAnswer
from
pretix.base.settings
import
settings_hierarkey
from
pretix.base.settings
import
settings_hierarkey
...
@@ -48,31 +48,27 @@ def add_public_registrations_table(sender, **kwargs):
...
@@ -48,31 +48,27 @@ def add_public_registrations_table(sender, **kwargs):
cached
=
sender
.
cache
.
get
(
'
public_registrations_table_
'
+
get_language
())
cached
=
sender
.
cache
.
get
(
'
public_registrations_table_
'
+
get_language
())
if
cached
is
None
:
if
cached
is
None
:
cached
=
""
cached
=
""
public_questions
=
[
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
))
q
for
q
in
sender
.
questions
.
all
()
if
str
(
q
.
pk
)
in
sender
.
settings
.
get
(
'
public_registrations_questions
'
)
]
headers
=
[
_
(
"
Name
"
)]
+
[
headers
=
[
_
(
"
Name
"
)]
+
[
q
.
question
for
q
in
public_questions
q
.
question
for
q
in
public_questions
]
]
order_positions
=
OrderPosition
.
objects
.
filter
(
order__event
=
sender
)
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_registration
'
)
==
"
True
"
if
op
.
meta_info_data
.
get
(
'
question_form_data
'
,
{}).
get
(
'
public_registration
'
)
==
"
True
"
and
str
(
op
.
item
.
pk
)
in
sender
.
settings
.
get
(
'
public_registrations_items
'
)
]
]
answers
=
QuestionAnswer
.
objects
.
filter
(
orderposition__in
=
public_order_positions
,
question__in
=
public_questions
)
public_answers
=
{
public_answers
=
{
pop
:
{
a
.
orderposition_id
:
{
pq
:
pop
.
answers
.
filter
(
question
=
pq
).
first
()
a
.
question_id
:
a
}
}
for
pq
in
public_questions
for
a
in
answers
for
pop
in
public_order_positions
}
}
public_registrations
=
[
public_registrations
=
[
{
{
'
gr_url
'
:
get_gravatar_url
(
pop
.
attendee_email
,
size
=
24
,
default
=
"
wavatar
"
),
'
gr_url
'
:
get_gravatar_url
(
pop
.
attendee_email
,
size
=
24
,
default
=
"
wavatar
"
),
'
fields
'
:
[
pop
.
attendee_name_cached
]
+
[
'
fields
'
:
[
pop
.
attendee_name_cached
]
+
[
public_answers
[
pop
][
pq
].
answer
if
public_answers
[
pop
][
pq
]
else
''
public_answers
[
pop
.
pk
][
pq
.
pk
].
answer
if
public_answers
.
get
(
pop
.
pk
,
None
)
and
public_answers
[
pop
.
pk
].
get
(
pq
.
pk
,
None
)
else
''
for
pq
in
public_questions
for
pq
in
public_questions
]
]
}
for
pop
in
public_order_positions
if
pop
.
attendee_email
and
pop
.
attendee_name_cached
}
for
pop
in
public_order_positions
if
pop
.
attendee_email
and
pop
.
attendee_name_cached
...
...
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