diff options
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:] |