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

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

+ 10 - 2
counter/views.py

143
                                                       tzinfo=None),
143
                                                       tzinfo=None),
144
                                                   locale='fr', threshold=1)
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
         # Drawing the graph
156
         # Drawing the graph
149
         line_data = ModelDataSource(resets, fields=['timestamp', 'Seum'])
157
         line_data = ModelDataSource(resets, fields=['timestamp', 'Seum'])
150
         line_chart = gchart.LineChart(line_data, options={
158
         line_chart = gchart.LineChart(line_data, options={