diff options
author | luxagraf <sng@luxagraf.net> | 2020-12-02 12:07:25 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-12-02 12:07:25 -0500 |
commit | 550127b86684e65277aa27cdb068308c820d5abb (patch) | |
tree | e907f9e5e96fbd2d0746046cf5f7dd1ff9535719 /app/photos/models.py | |
parent | 50a852c09f35fa3ce655b7979c179617a323eb63 (diff) |
added media app and migrations to move photo data
Diffstat (limited to 'app/photos/models.py')
-rw-r--r-- | app/photos/models.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/photos/models.py b/app/photos/models.py index 6253336..24a218f 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -70,9 +70,9 @@ class LuxImage(models.Model): height = models.CharField(max_length=6, blank=True, null=True) width = models.CharField(max_length=6, blank=True, null=True) point = models.PointField(null=True, blank=True) - location = models.ForeignKey("locations.Location", on_delete=models.CASCADE, null=True, blank=True) + location = models.ForeignKey("locations.Location", on_delete=models.CASCADE, null=True, blank=True, related_name="+") is_public = models.BooleanField(default=True) - sizes = models.ManyToManyField(LuxImageSize, blank=True) + sizes = models.ManyToManyField(LuxImageSize, blank=True, related_name="+") flickr_id = models.CharField(null=True, blank=True, max_length=80) twitter_link = models.CharField(null=True, blank=True, max_length=300) facebook_link = models.CharField(null=True, blank=True, max_length=300) @@ -110,6 +110,9 @@ class LuxImage(models.Model): def get_image_name(self): return self.image.url.split("original/")[1][5:-4] + def get_image_name_new(self): + return os.path.basename(self.image.path)[:-4] + def get_image_ext(self): return self.image.url[-3:] |