Skip to content

Commit

Permalink
Add gender filter
Browse files Browse the repository at this point in the history
  • Loading branch information
abkruse committed Dec 14, 2016
1 parent a555611 commit 123b459
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
20 changes: 14 additions & 6 deletions members/templates/members/profile_private.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% load email_tags %}
{% load static %}
{% load app_filters %}

<div class='row'>
<h3 class='col s9 oswald' style='margin-bottom:0;margin-top:2%;'>Private Details</h3>
<a class='col s1' href="{% url 'member_edit_profile' user.username %}"><img id='edit' alt='edit-icon' style='height:20px;'/></a>
<a class='col s1 tooltipped' data-position="bottom" data-tooltip="Edit Profile" href="{% url 'member_edit_profile' user.username %}" style='margin-top:3%;'><img id='edit' src="{% static 'img/edit.png' %}" alt='edit-icon'/></a>
</div>

<table>
Expand Down Expand Up @@ -84,7 +85,7 @@ <h3 class='col s9 oswald' style='margin-bottom:0;margin-top:2%;'>Private Details
{% if user.profile.gender %}
<tr>
<td>Gender:</td>
<td>{{ user.profile.gender }}</td>
<td>{{ user.profile.gender|gender_filter }}</td>
</tr>
{% endif %}
</table>
Expand All @@ -98,20 +99,27 @@ <h3 class='oswald'>
{% else %}
<table>
<tr>
<td>Name</td>
<td>Name:</td>
<td>{{ emergency_contact.name }}</td>
</tr>
<tr>
<td>Relationship</td>
<td>Relationship:</td>
<td>{{ emergency_contact.relationship }}</td>
</tr>
<tr>
<td>Phone</td>
<td>Phone:</td>
<td>{{ emergency_contact.phone }}</td>
</tr>
<tr>
<td>E-mail</td>
<td>E-mail:</td>
<td>{{ emergency_contact.email }}</td>
</tr>
</table>
{% endif %}


<script>
$(document).ready(function() {
$('.tooltipped').tooltip({delay: 50});
});
</script>
16 changes: 16 additions & 0 deletions nadine/templatetags/app_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from django import template
from django.template import Library

register = template.Library()

@register.filter
def gender_filter(value):
if value == 'F':
return 'Female'
elif value == 'M':
return 'Male'
elif value == 'O':
return 'Other'
else:
return 'Not shared'

0 comments on commit 123b459

Please sign in to comment.