This commit is contained in:
Anna Sudnitsina 2017-12-12 13:22:26 +03:00
parent 34096bf8c3
commit e1bc242477

View File

@ -9,8 +9,8 @@ import os
class Post(models.Model):
name = models.CharField(max_length=30, blank=True)
file = models.FileField(upload_to='images')
thumb_name = property(thumb_name)
orig_name = property(orig_name)
def publish(self):
self.published_date = timezone.now()
@ -23,6 +23,10 @@ class Post(models.Model):
x = os.path.split(self.file.name)[-1]
return '/thumb_' + x
thumb_name = property(thumb_name)
def orig_name(self):
x = os.path.split(self.file.name)[-1]
return x
return x
orig_name = property(orig_name)