""" 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,
('img', 'Scan or picture of notes'),
('pdf', 'PDF file'),
('ppt', 'Powerpoint'),
+ ('txt', 'Text'),
(UNKNOWN_FILE, 'Unknown file'),
)
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