class File(models.Model):
def make_upload_path(instance, filename):
name, extension = os.path.splitext(filename)
filename = '%s%s' % (slugify(name), extension)
d = datetime.datetime.now()
return u'upload/%s/%s/%s/%s' % (instance._meta.app_label,
instance._meta.module_name,
d.strftime('%d_%m_%Y'),
filename.lower())
file = SorlImageField(upload_to=make_upload_path, verbose_name='иконка',
blank=True)