Просмотр исходного кода

Formatting and no auto escaping in e-mails

Denis Merigoux лет назад: 9
Родитель
Сommit
58e4049446
2 измененных файлов с 12 добавлено и 2 удалено
  1. 2 0
      counter/templates/seumEmail.txt
  2. 10 2
      counter/views.py

+ 2 - 0
counter/templates/seumEmail.txt

@@ -1,3 +1,4 @@
1
+{% autoescape off %}
1 2
 {% if selfSeum %}
2 3
 {{name}} a le seum : {{reason}}
3 4
 {% else %}
@@ -7,3 +8,4 @@
7 8
 SeumBook™ - http://seum.merigoux.ovh
8 9
 
9 10
 P.S. : Pour ne plus recevoir ces messages, envoie un mail à denis.merigoux@gmail.com'''
11
+{% endautoescape %}

+ 10 - 2
counter/views.py

@@ -143,8 +143,16 @@ def home(request):
143 143
                                                       tzinfo=None),
144 144
                                                   locale='fr', threshold=1)
145 145
             }
146
-            reset.Seum = {
147
-                'v': 0, 'f': reset.counter.trigramme + " : " + reset.reason}
146
+            if (counter.lastReset.who is None or
147
+                    counter.lastReset.who.id == counter.id):
148
+                reset.Seum = {'v': 0,
149
+                              'f': reset.counter.trigramme +
150
+                              " : " + reset.reason}
151
+            else:
152
+                reset.Seum = {'v': 0,
153
+                              'f': reset.who.trigramme + ' à ' +
154
+                              reset.counter.trigramme +
155
+                              " : " + reset.reason}
148 156
         # Drawing the graph
149 157
         line_data = ModelDataSource(resets, fields=['timestamp', 'Seum'])
150 158
         line_chart = gchart.LineChart(line_data, options={