Commit 32ce5f1266629c48fccc31c6750bc69ad6df776c
1 parent
62501a73
Exists in
master
and in
39 other branches
Fixing tz issues
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
src/super_archives/models.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | 2 | ||
3 | -import datetime | ||
4 | from hashlib import md5 | 3 | from hashlib import md5 |
5 | 4 | ||
6 | from django.db import models | 5 | from django.db import models |
7 | from django.conf import settings | 6 | from django.conf import settings |
7 | +from django.utils import timezone | ||
8 | from django.contrib.auth.models import User | 8 | from django.contrib.auth.models import User |
9 | from django.core.urlresolvers import reverse, NoReverseMatch | 9 | from django.core.urlresolvers import reverse, NoReverseMatch |
10 | from django.utils.translation import ugettext_lazy as _ | 10 | from django.utils.translation import ugettext_lazy as _ |
@@ -144,7 +144,7 @@ class Thread(models.Model): | @@ -144,7 +144,7 @@ class Thread(models.Model): | ||
144 | 144 | ||
145 | # Save this pseudo now to avoid calling the | 145 | # Save this pseudo now to avoid calling the |
146 | # function N times in the loops below | 146 | # function N times in the loops below |
147 | - now = datetime.datetime.now() | 147 | + now = timezone.now() |
148 | days_ago = lambda date: (now - date).days | 148 | days_ago = lambda date: (now - date).days |
149 | get_score = lambda weight, created: \ | 149 | get_score = lambda weight, created: \ |
150 | max(weight - (days_ago(created) // 3), 5) | 150 | max(weight - (days_ago(created) // 3), 5) |
src/super_archives/views.py
@@ -14,7 +14,8 @@ from .models import MailingList, Thread | @@ -14,7 +14,8 @@ from .models import MailingList, Thread | ||
14 | def thread(request, mailinglist, thread_token): | 14 | def thread(request, mailinglist, thread_token): |
15 | 15 | ||
16 | try: | 16 | try: |
17 | - first_message = queries.get_first_message_in_thread(mailinglist, thread_token) | 17 | + first_message = queries.get_first_message_in_thread(mailinglist, |
18 | + thread_token) | ||
18 | except ObjectDoesNotExist: | 19 | except ObjectDoesNotExist: |
19 | raise Http404 | 20 | raise Http404 |
20 | order_by = request.GET.get('order') | 21 | order_by = request.GET.get('order') |