changeset 604:cebfaa233462

Show non-active status on view profile page. Bitbucket issue #14.
author Brian Neal <bgneal@gmail.com>
date Mon, 23 Jul 2012 19:51:11 -0500
parents 6a313b1f1201
children a7968613c469
files bio/templatetags/bio_tags.py sg101/templates/bio/view_profile.html
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bio/templatetags/bio_tags.py	Mon Jul 23 19:50:38 2012 -0500
+++ b/bio/templatetags/bio_tags.py	Mon Jul 23 19:51:11 2012 -0500
@@ -5,6 +5,7 @@
 from django.conf import settings
 from django.core.cache import cache
 
+import bio.models
 from bio.models import UserProfile
 
 
@@ -80,3 +81,17 @@
 
     """
     return {'username': username, 'trailing_text': trailing_text }
+
+
+@register.simple_tag
+def profile_status(profile):
+    """Returns a string to indicate member status for use on the view profile
+    page.
+
+    """
+    if (profile.status == bio.models.STA_ACTIVE or
+        profile.status == bio.models.STA_STRANGER):
+        return u''
+    else:
+        return u'(%s)' % profile.get_status_display()
+
--- a/sg101/templates/bio/view_profile.html	Mon Jul 23 19:50:38 2012 -0500
+++ b/sg101/templates/bio/view_profile.html	Mon Jul 23 19:51:11 2012 -0500
@@ -38,7 +38,7 @@
    <tr><th>Full Name</th><td>{{ subject.get_full_name }}</td></tr>
    <tr><th>Date Joined</th><td>{{ subject.date_joined|date:"F d, Y" }}</td></tr>
    <tr><th>Last Login</th><td>{% forum_date subject.last_login user %}</td></tr>
-   <tr><th>Active Member</th><td>{% bool_icon subject.is_active %}</td></tr>
+   <tr><th>Active Member</th><td>{% bool_icon subject.is_active %} {% profile_status profile %}</td></tr>
    <tr><th>Staff Member</th><td>{% bool_icon subject.is_staff %}</td></tr>
    {% if profile.location %}
    <tr><th>Location</th><td>{{ profile.location }}</td></tr>