]> git.parisson.com Git - telemeta.git/commitdiff
hide some user fields for basic users
authoryomguy <yomguy@parisson.com>
Tue, 29 Mar 2011 16:56:02 +0000 (18:56 +0200)
committeryomguy <yomguy@parisson.com>
Tue, 29 Mar 2011 16:56:02 +0000 (18:56 +0200)
telemeta/locale/fr/LC_MESSAGES/django.mo
telemeta/locale/fr/LC_MESSAGES/django.po
telemeta/models/system.py
telemeta/templates/telemeta_default/profile_edit.html
telemeta/web/base.py

index f33603410fde314e57e2d1166a2ebd272e7b81fe..9f04b7d01900bd3d0056f947f1525e3d3120f815 100644 (file)
Binary files a/telemeta/locale/fr/LC_MESSAGES/django.mo and b/telemeta/locale/fr/LC_MESSAGES/django.mo differ
index 1766ebc57f761da441d38332b4257f35c8ff9013..fe0827caf4064c28fe1b091b264b8cd89f05bffd 100644 (file)
@@ -836,3 +836,47 @@ msgstr "Énumérations"
 #: web.base.py:955
 msgid "Access not allowed"
 msgstr "Accès non autorisé"
+
+#: templates/telemeta_default/profile_detail.html:11
+msgid "User profile"
+msgstr "Profil utilisateur"
+
+#: templates/telemeta_default/profile_detail.html:12
+msgid "Institution"
+msgstr "Institution"
+
+#: templates/telemeta_default/profile_detail.html:13
+msgid "Function"
+msgstr "Fonction"
+
+#: templates/telemeta_default/profile_detail.html:14
+msgid "Address"
+msgstr "Adresse"
+
+#: templates/telemeta_default/profile_detail.html:15
+msgid "Telephone"
+msgstr "Téléphone"
+
+#: templates/telemeta_default/profile_detail.html:16
+msgid "Last Name"
+msgstr "Nom"
+
+#: templates/telemeta_default/profile_detail.html:17
+msgid "First Name"
+msgstr "Prénom"
+
+#: templates/telemeta_default/profile_detail.html:18
+msgid "Expiration date"
+msgstr "Date d'expiration"
+
+#: templates/telemeta_default/profile_detail.html:19
+msgid "Is admin"
+msgstr "Est admin"
+
+#: templates/telemeta_default/profile_detail.html:20
+msgid "Is superuser"
+msgstr "Est superuser"
+
+#: templates/telemeta_default/profile_detail.html:21
+msgid "Last login"
+msgstr "Dernière connexion"
index 1d5beaa1a7e6d94f1d67ee916fd775d6d19963ee..5452c9e628ef1bd362288e446eaa083adccf3113 100644 (file)
@@ -79,7 +79,7 @@ class UserProfile(django.db.models.Model):
     institution     = CharField(_('institution'))
     function        = CharField(_('function'))
     address         = TextField(_('address'))
-    telephone       = CharField(_('function'))
+    telephone       = CharField(_('telephone'))
     expiration_date = DateField(_('expiration_date'))
     
     class Meta(MetaCore):
index 5e92b5f1000969fbedaf0df67c5bf7015ef789ba..d94e0f542905fc1cf7cfb0031b7c9cf9a1e5ac3f 100644 (file)
        
         <form method="POST" id="_editUserProfileForm" action="">{% csrf_token %}
        <table>
-       
-        {% for field in user_form %}
-        <tr>
-            <tr><td class="error">{{ field.errors }}</td></tr>
-            <td>{{ field.label_tag }}:</td><td> {{ field }}</td>
-        </tr>
-        {% endfor %}
-       
-       
-        {% for field in profile_form %}
-        {% if field.html_name != "user" %}
+       {% for form in forms %}
+        {% for field in form %}
+        {% if not field.html_name in hidden_fields %}
         <tr>
             <tr><td class="error">{{ field.errors }}</td></tr>
-            <td>{{ field.label_tag }}:</td><td> {{ field }}</td>
+            <td>{% trans field.label_tag %}:</td><td>{{ field }}</td>
         </tr>
         {% else %}
-        <tr style="display:none;">
-          <td>{{ field.label_tag }}:</td><td> {{ field }}</td>
+        <tr>
+          <td>{{ field.label_tag.as_hidden }}</td><td>{{ field.as_hidden }}</td>
         </tr>
         {% endif %}
         {% endfor %}
+       {% endfor %}
        </table>
         <div align="center">
          <a href="{% url telemeta-profile-detail usr.username %}" class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
index 5738d4a36d10b917a2beea295562dcacc51ab63e..25bd6533b027de1b8a0c71d3fb13a24fbfda8fc5 100644 (file)
@@ -1023,6 +1023,13 @@ class WebView(object):
         return render(request, template, {'profile' : profile, 'usr': user})
         
     def profile_edit(self, request, username, template='telemeta/profile_edit.html'):
+        if request.user.is_staff:
+            user_hidden_fields = []
+        else:
+            user_hidden_fields = ['user-username', 'user-is_staff', 'profile-user', 'user-is_active', 
+                         'user-password', 'user-last_login', 'user-date_joined', 'user-groups', 
+                         'user-user_permissions', 'user-is_superuser', 'profile-expiration_date']
+        
         user = User.objects.get(username=username)
         if user != request.user and not request.user.is_staff:
             return HttpResponseRedirect('/accounts/'+username+'/not_allowed/')
@@ -1043,5 +1050,6 @@ class WebView(object):
         else:
             user_form = UserChangeForm(instance=user, prefix='user')
             profile_form = UserProfileForm(instance=profile, prefix='profile')
-        return render(request, template, {"user_form": user_form, "profile_form": profile_form, 'usr': user})
+            forms = [user_form, profile_form]
+        return render(request, template, {'forms': forms, 'usr': user, 'hidden_fields': user_hidden_fields})