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
873f373d
Commit
873f373d
authored
5 years ago
by
Felix Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
The cache didn't invalidate as expected
parent
efa1e680
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
+37
-42
37 additions, 42 deletions
pretix_public_registrations/signals.py
with
37 additions
and
42 deletions
pretix_public_registrations/signals.py
+
37
−
42
View file @
873f373d
...
@@ -46,49 +46,44 @@ def add_public_registration_question(sender, position, **kwargs):
...
@@ -46,49 +46,44 @@ 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
):
cached
=
sender
.
cache
.
get
(
'
public_registrations_table_
'
+
get_language
())
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
))
if
cached
is
None
:
headers
=
(
cached
=
""
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
public_questions
=
sender
.
questions
.
filter
(
pk__in
=
sender
.
settings
.
get
(
'
public_registrations_questions
'
))
)
+
(
headers
=
(
[
_
(
"
Name
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_attendee_name
'
)
else
[]
[
_
(
"
Product
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
)
+
[
)
+
(
q
.
question
for
q
in
public_questions
[
_
(
"
Name
"
)]
if
sender
.
settings
.
get
(
'
public_registrations_show_attendee_name
'
)
else
[]
]
)
+
[
order_positions
=
OrderPosition
.
objects
.
filter
(
order__event
=
sender
,
item__pk__in
=
sender
.
settings
.
get
(
'
public_registrations_items
'
))
q
.
question
for
q
in
public_questions
public_order_positions
=
[
]
op
for
op
in
order_positions
order_positions
=
OrderPosition
.
objects
.
filter
(
order__event
=
sender
,
item__pk__in
=
sender
.
settings
.
get
(
'
public_registrations_items
'
))
if
op
.
meta_info_data
.
get
(
'
question_form_data
'
,
{}).
get
(
'
public_registrations_public_registration
'
)
public_order_positions
=
[
]
op
for
op
in
order_positions
answers
=
QuestionAnswer
.
objects
.
filter
(
orderposition__in
=
public_order_positions
,
question__in
=
public_questions
)
if
op
.
meta_info_data
.
get
(
'
question_form_data
'
,
{}).
get
(
'
public_registrations_public_registration
'
)
public_answers
=
{
]
a
.
orderposition_id
:
{
answers
=
QuestionAnswer
.
objects
.
filter
(
orderposition__in
=
public_order_positions
,
question__in
=
public_questions
)
a
.
question_id
:
a
public_answers
=
{
a
.
orderposition_id
:
{
a
.
question_id
:
a
}
for
a
in
answers
}
}
public_registrations
=
[
for
a
in
answers
{
}
'
gr_url
'
:
get_gravatar_url
(
pop
.
attendee_email
or
pop
.
order
.
code
,
size
=
24
,
default
=
"
wavatar
"
),
public_registrations
=
[
'
fields
'
:
(
{
[
pop
.
item
.
name
]
if
sender
.
settings
.
get
(
'
public_registrations_show_item_name
'
)
else
[]
'
gr_url
'
:
get_gravatar_url
(
pop
.
attendee_email
or
pop
.
order
.
code
,
size
=
24
,
default
=
"
wavatar
"
),
)
+
(
'
fields
'
:
(
[
pop
.
attendee_name_cached
]
if
sender
.
settings
.
get
(
'
public_registrations_show_
attendee
_name
'
)
else
[]
[
pop
.
item
.
name
]
if
sender
.
settings
.
get
(
'
public_registrations_show_
item
_name
'
)
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
''
[
pop
.
attendee_name_cached
]
if
sender
.
settings
.
get
(
'
public_registrations_show_attendee_name
'
)
else
[]
for
pq
in
public_questions
)
+
[
]
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
p
op
in
public_
order_posi
tions
for
p
q
in
public_
ques
tions
]
]
template
=
get_template
(
'
pretix_public_registrations/front_page.html
'
)
}
for
pop
in
public_order_positions
cached
=
template
.
render
({
]
'
headers
'
:
headers
,
template
=
get_template
(
'
pretix_public_registrations/front_page.html
'
)
'
public_registrations
'
:
public_registrations
return
template
.
render
({
})
'
headers
'
:
headers
,
sender
.
cache
.
set
(
'
public_registrations
_table_
'
+
get_language
(),
cached
)
'
public_registrations
'
:
public_registrations
return
cached
})
@receiver
(
signal
=
process_response
,
dispatch_uid
=
"
public_registragions_csp_headers
"
)
@receiver
(
signal
=
process_response
,
dispatch_uid
=
"
public_registragions_csp_headers
"
)
...
...
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