[#4713] Bugfix
authorEric Mc Sween <eric.mcsween@auf.org>
Thu, 22 Nov 2012 15:12:45 +0000 (10:12 -0500)
committerEric Mc Sween <eric.mcsween@auf.org>
Thu, 22 Nov 2012 15:12:45 +0000 (10:12 -0500)
project/rh/templatetags/rapports.py

index 08045fa..b013435 100644 (file)
@@ -196,11 +196,10 @@ def filter_debut_contrat(context):
 @register.inclusion_tag('admin/filter_select.html', takes_context=True)
 def filter_a_venir(context):
     today = datetime.date.today()
-    year, month, day = datetime.date.today().timetuple()[:3]
-    mois_prochain = datetime.date(
-        year + (month + 1) / 13, (month + 1) % 12, 1
-    )
-    this_month = datetime.date(year, month, 1)
+    mois_prochain = datetime.date(today.year, today.month + 1, 1) \
+            if today.month < 12 \
+            else datetime.date(today.year + 1, today.month, 1)
+    this_month = datetime.date(today.year, today.month, 1)
 
     field_name = 'date_debut'
     return {'title': u"à venir",