Commits

Peter Sanchez committed 131530a

Small version bump. Django 1.4+ support for timezones

Comments (0)

Files changed (3)

 from callback.signals import stored_callback, processed_callback, error_callback
 
 
-__version__ = '0.5'
+__version__ = '0.6'
 __all__ = [
     'CallbackException', 'CallbackBase', 'callback_manager',
     'stored_callback', 'processed_callback', 'error_callback',
 import hashlib
 import datetime
 from django.db import models
+from django.utils import timezone
 from django.contrib.auth.models import User
 
 Q = models.Q
         return self.get_query_set().filter(query)
 
     def all_expired_callbacks(self, days=7, delete_errors=False):
-        use_date = datetime.date.today() - datetime.timedelta(days=days)
+        use_date = timezone.now().date() - datetime.timedelta(days=days)
         query = Q(is_active=False) 
         if not delete_errors:
             query &= Q(is_error=False)
-import datetime
 from django.db import models
+from django.utils import timezone
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.contenttypes import generic
 from callback.managers import CallbackMapManager
     is_error = models.BooleanField(default=False)
     error_msg = models.TextField(blank=True)
 
-    created_on = models.DateTimeField(default=datetime.datetime.now)
-    updated_on = models.DateTimeField(default=datetime.datetime.now)
+    created_on = models.DateTimeField(default=timezone.now)
+    updated_on = models.DateTimeField(default=timezone.now)
 
     objects = CallbackMapManager()
 
 
     def save(self, *args, **kwargs):
         if self.id:
-            self.updated_on = datetime.datetime.now()
+            self.updated_on = timezone.now()
         super(CallbackMap, self).save(*args, **kwargs)