summaryrefslogtreecommitdiff
path: root/app/links/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/links/models.py')
-rw-r--r--app/links/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/links/models.py b/app/links/models.py
index cdbe680..8ebc962 100644
--- a/app/links/models.py
+++ b/app/links/models.py
@@ -35,6 +35,10 @@ def email_link(link):
msg.send()
+def get_upload_path(self, filename):
+ return "images/links/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename)
+
+
class Link(models.Model):
title = models.CharField(max_length=400)
url = models.CharField(max_length=400)
@@ -47,6 +51,7 @@ class Link(models.Model):
)
status = models.IntegerField(choices=PUB_STATUS, default=0)
tags = TaggableManager(blank=True)
+ image = models.FileField(blank=True, null=True, upload_to=get_upload_path)
class Meta:
ordering = ['-pub_date']