diff options
author | luxagraf <sng@luxagraf.net> | 2018-04-05 09:30:44 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-04-05 09:30:44 -0400 |
commit | a26ad92062c8d1ab13727a2a4f4293d17d09808c (patch) | |
tree | f40e6d729fab874fb80376f32be9da84d13120d5 /app/links/models.py | |
parent | 2d440f0c309f49803ec95c46d9f586a7305780cd (diff) |
added image to links for screencaptures
Diffstat (limited to 'app/links/models.py')
-rw-r--r-- | app/links/models.py | 5 |
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'] |