Changeset - 1355c0ba83d3
[Not reviewed]
0 1 0
Christopher Neugebauer - 4 years ago 2017-11-29 02:26:05
chrisjrn@gmail.com
sigh
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/templatetags/nbpy_tags.py
Show inline comments
...
 
@@ -49,49 +49,52 @@ def donation_income(context, invoice):
 

	
 
@register.simple_tag
 
def name_split(name, split_characters=None):
 

	
 
    tokens = name.split()
 
    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)
 
    return f
 

	
 

	
 
@register.simple_tag(takes_context=True)
 
def special(context, user):
 
    organiser = user.groups.filter(name='Conference organisers').exists()
 
    speaker = if hasattr(user, "speaker_profile") and user.speaker_profile.presentations.count() != 0
 
    try:
 
        speaker = user.speaker_profile.presentations.count() != 0
 
    except:
 
        speaker = False
 
    volunteer = "Volunteer" in ticket_type(context)
 

	
 
    if organiser:
 
        return "Organizer"
 
    elif speaker:
 
        return "Speaker"
 
    elif volunteer:
 
        return "Staff"
 
    else:
 
        return ""
 

	
 

	
 
CLEARED = set([
 
    "BeeWare Project",
 
    "Project Jupyter",
 
    "PSF Packaging WG / PyCon 2018 Chair",
 
    "PyCon Ukraine",
 
    "PyLadies PDX",
 
    "Recovered Silver",
 
    "Twisted",
 
    "@vmbrasseur",
 
])
 

	
 
@register.simple_tag
0 comments (0 inline, 0 general)