]> git.parisson.com Git - teleforma.git/commitdiff
add student profile infos on links in message list
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 13 Jul 2015 08:31:48 +0000 (10:31 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 13 Jul 2015 08:31:48 +0000 (10:31 +0200)
teleforma/templates/postman/view.html
teleforma/templatetags/teleforma_tags.py

index 4626eda4a68ee3e4e28378ccc90f2b81462db6d6..7822482af2d75de4e66478b4911b2931bcc0c617 100644 (file)
 {% for message in pm_messages %}
 <div class="pm_message{% if message.is_pending %} pm_pending{% endif %}{% if message.is_rejected %} pm_rejected{% endif %}{% if message.sender == user and message.sender_archived or message.recipient == user and message.recipient_archived %} pm_archived{% endif %}{% if message.sender == user and message.sender_deleted_at or message.recipient == user and message.recipient_deleted_at %} pm_deleted{% endif %}{% if message.recipient == user and not message.read_at %} pm_unread{% endif %}">
  <div class="pm_header">
-  <a href="{% url telemeta-profile-detail message.obfuscated_sender %}">
+  <a href="{% url telemeta-profile-detail message.obfuscated_sender %}" title="{% get_training_profile message.sender %}">
   <span class="pm_sender">{{ message.obfuscated_sender|or_me:user }}</span>
   </a>&raquo;
-  <a href="{% url telemeta-profile-detail message.obfuscated_recipient %}">
+  <a href="{% url telemeta-profile-detail message.obfuscated_recipient %}" title="{% get_training_profile message.recipient %}">
   <span class="pm_recipient">{{ message.obfuscated_recipient|or_me:user }}</span>
   </a> |
   <span class="pm_date">{{ message.sent_at|date:"DATETIME_FORMAT"}}</span> |
index 8649fc3754d3683cb2aa7dedcce642bce6f3ff19..24f0253a0a0c9f39db3c1a93c2349d7468e74b4c 100644 (file)
@@ -229,3 +229,15 @@ def treated_scripts_count(user, period):
         return ' (' + str(len(scripts)) + ')'
     else:
         return ''
+
+@register.simple_tag
+def get_training_profile(user):
+    text = ''
+    student = user.student.all()
+    if student:
+        student = student[0]
+        if student.platform_only:
+            text += '(I)'
+        for training in student.trainings.all():
+            text += ' - ' + unicode(training)
+    return text