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 | 1 | # -*- coding: utf-8 -*- |
| 2 | 2 | |
| 3 | -import datetime | |
| 4 | 3 | from hashlib import md5 |
| 5 | 4 | |
| 6 | 5 | from django.db import models |
| 7 | 6 | from django.conf import settings |
| 7 | +from django.utils import timezone | |
| 8 | 8 | from django.contrib.auth.models import User |
| 9 | 9 | from django.core.urlresolvers import reverse, NoReverseMatch |
| 10 | 10 | from django.utils.translation import ugettext_lazy as _ |
| ... | ... | @@ -144,7 +144,7 @@ class Thread(models.Model): |
| 144 | 144 | |
| 145 | 145 | # Save this pseudo now to avoid calling the |
| 146 | 146 | # function N times in the loops below |
| 147 | - now = datetime.datetime.now() | |
| 147 | + now = timezone.now() | |
| 148 | 148 | days_ago = lambda date: (now - date).days |
| 149 | 149 | get_score = lambda weight, created: \ |
| 150 | 150 | max(weight - (days_ago(created) // 3), 5) | ... | ... |
src/super_archives/views.py
| ... | ... | @@ -14,7 +14,8 @@ from .models import MailingList, Thread |
| 14 | 14 | def thread(request, mailinglist, thread_token): |
| 15 | 15 | |
| 16 | 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 | 19 | except ObjectDoesNotExist: |
| 19 | 20 | raise Http404 |
| 20 | 21 | order_by = request.GET.get('order') | ... | ... |