remove password link for egonomy external users V00.09.02
authorymh <ymh.work@gmail.com>
Wed, 02 Apr 2014 01:53:34 +0200
changeset 289 2876dcae02e4
parent 288 22791d0db35e
child 290 0ed5a088fdf4
remove password link for egonomy external users
src/egonomy/__init__.py
src/egonomy/templates/egonomy_base.html
src/egonomy/templatetags/egostringfilters.py
src/egonomy/utils/context_processors.py
--- a/src/egonomy/__init__.py	Tue Apr 01 17:47:40 2014 +0200
+++ b/src/egonomy/__init__.py	Wed Apr 02 01:53:34 2014 +0200
@@ -1,4 +1,4 @@
-VERSION = (0, 9, 1, "final", 0)
+VERSION = (0, 9, 2, "final", 0)
 
 VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2])))
 
--- a/src/egonomy/templates/egonomy_base.html	Tue Apr 01 17:47:40 2014 +0200
+++ b/src/egonomy/templates/egonomy_base.html	Wed Apr 02 01:53:34 2014 +0200
@@ -1,5 +1,6 @@
 {% load static %}
 {% load i18n %}
+{% load egostringfilters %}
 <!DOCTYPE html>
 <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
 <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
@@ -83,7 +84,7 @@
 		                </form>
                     </li>
                   {% if user.is_authenticated %}
-                    <li class="hello-user">{% trans "Hello" %} <a href="{% url 'auth_password_change' %}">{{ user.username }}</a>
+                    <li class="hello-user">{% trans "Hello" %} {% if user.username|startswith:EGONOMY_USER_PREFIX %}{{ user.username }}{% else %}<a href="{% url 'auth_password_change' %}">{{ user.username }}</a>{% endif %}</li>
                     <li><span class="dot-6"></span></li>
                     <li><a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a></li>
                   {% else %}
--- a/src/egonomy/templatetags/egostringfilters.py	Tue Apr 01 17:47:40 2014 +0200
+++ b/src/egonomy/templatetags/egostringfilters.py	Wed Apr 02 01:53:34 2014 +0200
@@ -18,3 +18,11 @@
     if autoescape:
         value = escape(value)
     return mark_safe(value.replace('\n', '\\n'))
+
+@register.filter
+def startswith(value, arg):
+    """
+    Returns True if the given string starts with an argument prefix, otherwise returns False.
+    """
+
+    return value.startswith(arg)
\ No newline at end of file
--- a/src/egonomy/utils/context_processors.py	Tue Apr 01 17:47:40 2014 +0200
+++ b/src/egonomy/utils/context_processors.py	Wed Apr 02 01:53:34 2014 +0200
@@ -19,5 +19,5 @@
         url_parts[4] = urllib.urlencode(url_params, doseq=True)
         egonomy_url = urlparse.urlunparse(url_parts)
 
-    return {'VERSION': egonomy.get_version(), 'EGONOMY_URL': egonomy_url }
+    return {'VERSION': egonomy.get_version(), 'EGONOMY_URL': egonomy_url, 'EGONOMY_USER_PREFIX': getattr(settings, 'EGONOMY_USER_PREFIX', '')}