[damned-lies] Warn when user did not join any translation team after login



commit 383610b56cc374c005a9d5f7e38f5d1e812f3c45
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Apr 21 17:58:53 2009 +0200

    Warn when user did not join any translation team after login
    
    People creating account on l10n.gnome.org don't always realize
    they have to explicitely join a team. This message reminds
    them to do it. Thanks to Aron Xu for the suggestion.
---
 common/views.py     |    6 ++++++
 templates/base.html |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/common/views.py b/common/views.py
index e28e9c1..f5d0950 100644
--- a/common/views.py
+++ b/common/views.py
@@ -26,6 +26,7 @@ from django.utils.translation import ugettext as _
 from django.contrib.auth import login, authenticate, logout
 from django.conf import settings
 from people.models import Person
+from teams.models import Role
 from people.forms import RegistrationForm 
 
 
@@ -61,6 +62,11 @@ def site_login(request, msgs=[]):
                     login(request, user)
                     message = _("You have been successfully logged in.")
                     user.message_set.create(message=message)
+                    if Role.objects.filter(person__username=user.username).count() < 1:
+                        message = _("You have not joined any translation team yet. You can do it from <a href=\"%(url)s\">your profile</a>.") % {
+                            'url': reverse('person-team-join-view'),
+                        }
+                        user.message_set.create(message=message)
                     if request.POST['referer']:
                         return HttpResponseRedirect(request.POST['referer'])
                     else:
diff --git a/templates/base.html b/templates/base.html
index 798196d..ba2467f 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -82,7 +82,7 @@
     <div id="content">
     {% if messages %}
         {% for message in messages %}
-        <p class="errornote">{{ message }}</p>
+        <p class="errornote">{{ message|safe }}</p>
         {% endfor %}
     {% endif %}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]