1. catapela
  2. django-dynamic-link

Commits

catapela  committed d4679da

solve Timezone problem - see issues

  • Participants
  • Parent commits 2847368
  • Branches default

Comments (0)

Files changed (2)

File dynamicLink/models.py

View file
  • Ignore whitespace
 import random
 import os
 import datetime
+from django.utils import timezone
 
 class Download(models.Model):
     slug = models.SlugField(verbose_name=_('slug'), blank=False, unique=True)
     def timeout_time(self):
         """If timout time is reached it returs True"""
         if not self.timeout_hours == 0: # never timeout through time
-            if self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours) < datetime.datetime.now():
+            if self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours) < timezone.now():
                 return True
 
     def timeout(self):
         """Is shown at the admit list display"""
         if self.timeout_hours == 0:
             return '<span style="color: #FF7F00; ">%s</span>' % unicode(_(u'never expires'))
-        return (self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours)) - datetime.datetime.now()
+        return (self.timestamp_creation + datetime.timedelta(hours=self.timeout_hours)) - timezone.now()
 
     def set_link(self, file, slug='autogenerated', timeout=None, maxclicks=None):
         self.slug = slug

File dynamicLink/version.py

View file
  • Ignore whitespace
 # -*- coding:utf-8 -*-
 # This Python file uses the following encoding: utf-8
 
-import django
-import sys
-
-VERSION = (0,5,6,0)
+VERSION = (0,5,6,1)
 RELEASE_DJANGO = ((1,2),(1,3),(1,4))
 PYTHON_MIN = (2,4)
 REQUIRES ="""
 Modification date: 03.08.2011
 
 Hints:
+- 0.5.6.1   Timezone bug changes
 - 0.5.6     Example Project runs with Django 1.4
 - 0.5.5     dynamicLink.CKISNT() function added.
 - 0.5.4.1   Canges in setup.py - READM will now alsow be installed. Now if a package