places ENML to XML mimetype conversion in the wrong place, this should work for celery.
[oweals/karmaworld.git] / karmaworld / apps / notes / models.py
index 63e3a9cbfc72823bc496db8f3d0bfd1bb716d065..cc7a262991ca8e20089dcd55de85e3d3611760a1 100644 (file)
@@ -76,7 +76,7 @@ class Document(models.Model):
         """ generate a unique slug based on name and uploaded_at  """
         _slug = defaultfilters.slugify(self.name)
         klass = self.__class__
-        collision = klass.objects.filter(slug=self.slug)
+        collision = klass.objects.filter(slug=_slug)
         if collision:
             _slug = u"{0}-{1}-{2}-{3}".format(
                     _slug, self.uploaded_at.month,
@@ -127,6 +127,7 @@ class Note(Document):
         ('img', 'Scan or picture of notes'),
         ('pdf', 'PDF file'),
         ('ppt', 'Powerpoint'),
+        ('txt', 'Text'),
         (UNKNOWN_FILE, 'Unknown file'),
     )
 
@@ -136,15 +137,14 @@ class Note(Document):
                             blank=True, null=True)
 
     # Upload files to MEDIA_ROOT/notes/YEAR/MONTH/DAY, 2012/10/30/filename
-    # FIXME: because we are adding files by hand in tasks.py, upload_to is being ignored for media files
     pdf_file       = models.FileField(                  \
                             storage=fs,                 \
-                            upload_to="notes/%Y/%m/%j/",\
+                            upload_to="notes/%Y/%m/%d/",\
                             blank=True, null=True)
     # No longer keeping a local copy backed by django
     note_file       = models.FileField(                 \
                             storage=fs,                 \
-                            upload_to="notes/%Y/%m/%j/",\
+                            upload_to="notes/%Y/%m/%d/",\
                             blank=True, null=True)
 
     # Google Drive URLs