diff --git a/pinaxcon/templates/registrasion/badge.svg b/pinaxcon/templates/registrasion/badge.svg index 499ac6dbadf37296911a9ada27f4fdcbaa923af6..162e096f42b97209091ea67bf7babfadf4bebe5d 100644 --- a/pinaxcon/templates/registrasion/badge.svg +++ b/pinaxcon/templates/registrasion/badge.svg @@ -1,158 +1,13 @@ - - +{% spaceless %} - +{% load nbpy_tags %} +{% name_split user.attendee.attendeeprofilebase.attendeeprofile.name as split_name %} +{% ticket_type as ticket %} +{% affiliation ticket user as aff %} +{% company_split aff as split_affiliation %} - - - - - - - image/svg+xml - - - - - - - {{ user.attendee.attendeeprofilebase.attendeeprofile.name }}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1 }}{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2 }}{% if user.attendee.attendeeprofilebase.attendeeprofile.of_legal_age %}18+?{% else %}MINOR{% endif %}DINNER: {{ dinner_count }}BREAKFAST: {{ breakfast_count }}TICKET: {% for ticket in ticket %}{{ ticket.product.name }}{% endfor %} - - - +{% with name1=split_name.first name2=split_name.last affiliation1=split_affiliation.first affiliation2=split_affiliation.last %} + {% include "registrasion/badge_outer.svg" %} +{% endwith %} + +{% endspaceless %} diff --git a/pinaxcon/templates/registrasion/badge_outer.svg b/pinaxcon/templates/registrasion/badge_outer.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f2d3c2763f4e65b2f28be2c98a82ea375df8891 --- /dev/null +++ b/pinaxcon/templates/registrasion/badge_outer.svg @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + {{ name1 }}{{ name2 }} + {{ affiliation1 }}{{ affiliation2 }} + + + + + + + + + + + {{ name1 }}{{ name2 }} + {{ affiliation1 }}{{ affilitaion2 }} + + + + diff --git a/pinaxcon/templatetags/nbpy_tags.py b/pinaxcon/templatetags/nbpy_tags.py index e3f51d889d77af5692f60580c3e570be87832493..9228dab1a304d46d4bc894e7c10cb4ea743e9cb2 100644 --- a/pinaxcon/templatetags/nbpy_tags.py +++ b/pinaxcon/templatetags/nbpy_tags.py @@ -48,16 +48,48 @@ def donation_income(context, invoice): # TODO: include van/de/van der/de la/etc etc etc @register.simple_tag -def name_split(name): +def name_split(name, split_characters=None): tokens = name.split() - even_split = int((len(tokens) + 1) / 2) # Round up. + if split_characters is None or len(name) > split_characters: + even_split = int((len(tokens) + 1) / 2) # Round up. + else: + even_split = len(tokens) return { "first" : " ".join(tokens[:even_split]), "last" : " ".join(tokens[even_split:]), } +@register.simple_tag +def company_split(name): + f = name_split(name, 18) + print f + return f + + + +CLEARED = set([ + "BeeWare Project", + "Project Jupyter", + "PSF Packaging WG / PyCon 2018 Chair", + "PyCon Ukraine", + "PyLadies PDX", + "Recovered Silver", + "Twisted", + "@vmbrasseur", +]) + +@register.simple_tag +def affiliation(ticket, user): + aff = user.attendee.attendeeprofilebase.attendeeprofile.company + if "Individual" not in ticket or "Sponsor" in ticket: + return aff + elif ticket == "Individual Supporter" and aff in CLEARED: + return aff + else: + return "" + @register.simple_tag(takes_context=True) def ticket_type(context):