Commits

Chris Franklin committed ceaefda

Fix datetime mess

  • Participants
  • Parent commits 8b1b542

Comments (0)

Files changed (2)

redactormedia/models.py

 
     upload = models.FileField(upload_to="uploads/%Y/%m/%d/")
     owner = models.ForeignKey(User, null=True, related_name='uploadimages')
-    date_created = models.DateTimeField(default=datetime.now)
+    datetime = models.DateTimeField(default=datetime.now)
     is_image = models.BooleanField(default=True)
 
 
     category = models.ForeignKey(MediaFileCategory, null=True)
     upload = models.FileField(upload_to="uploads/%Y/%m/%d/")
     owner = models.ForeignKey(User, null=True, related_name='uploadfiles')
-    date_created = models.DateTimeField(default=datetime.now)
+    datetime = models.DateTimeField(default=datetime.now)
     is_image = models.BooleanField(default=True)
-    created = models.DateTimeField(auto_now_add = True)
-    modified = models.DateTimeField(auto_now = True)
 
     def __unicode__(self):
         return u"{0}".format(self.title[:25],)

redactormedia/views.py

     images = [
         {"thumb": obj.upload.url, "image": obj.upload.url}
         for obj in File.objects.filter(is_image=True).order_by(
-            "-date_created")[:40]
+            "-datetime")[:40]
     ]
     return HttpResponse(json.dumps(images), mimetype="application/json")
 
              {'size': (100, 100), 'crop': True}).url,
          'image': obj.upload.url, "title": obj.title}\
             for obj in MediaFile.objects.filter(
-                owner=request.user).order_by("-date_created")
+                owner=request.user).order_by("-datetime")
         ]
 
         return HttpResponse(simplejson.dumps(images))