Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 40f22c5

Browse files
authored
Add a template tag to list a user current conference tickets (#1371)
* initial * renamed to something more sensible * Add a required checkbox to the CfP proposal submission page. The checkbox content is not stored in the database, but submission will fail unless checked. * added test to verify that speakers do have to agree to the speaker release agreement * initial * renamed to something more sensible * Added a template simple_tag to list a user tickets for the current conference. Uses functionality already implemented. * Added documentation * Added a template simple_tag to list a user tickets for the current conference. Uses functionality already implemented.
1 parent 6e078a7 commit 40f22c5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

conference/templatetags/conference.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.urls import reverse
88

99
from conference import dataaccess, models
10+
from conference.user_panel import get_tickets_for_current_conference
1011

1112
mimetypes.init()
1213

@@ -118,3 +119,26 @@ def attrib_(ob, attrib):
118119
return getattr(ob, attrib, None)
119120
else:
120121
return [attrib_(x, attrib) for x in ob]
122+
123+
124+
@register.simple_tag
125+
def tickets(user):
126+
"""
127+
Return the list of tikets `user` has assigned to them, for the current
128+
conference only.
129+
130+
Example usage in a template
131+
{% load conference %}
132+
133+
{% if user.is_authenticated %}
134+
You are logged in and these are your tickets:
135+
{% tickets user as tickets %}
136+
137+
{% for ticket in tickets %}
138+
<p>{{ ticket }}</p>
139+
{% endfor %}
140+
{% else %}
141+
Booo! You need to login.
142+
{% endif %}
143+
"""
144+
return get_tickets_for_current_conference(user)

0 commit comments

Comments
 (0)