fix: return empty string from image URL methods when no file is linked
This commit is contained in:
parent
8d77299b34
commit
b121dc82e3
1 changed files with 3 additions and 1 deletions
|
|
@ -396,6 +396,8 @@ class Photo(MediaModel):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_size_url(self, size):
|
def _get_size_url(self, size):
|
||||||
|
if not self.image:
|
||||||
|
return ""
|
||||||
photosize = PhotoSizeCache().sizes.get(size)
|
photosize = PhotoSizeCache().sizes.get(size)
|
||||||
if not self.size_exists(photosize):
|
if not self.size_exists(photosize):
|
||||||
self.create_size(photosize)
|
self.create_size(photosize)
|
||||||
|
|
@ -620,7 +622,7 @@ class Photo(MediaModel):
|
||||||
return reverse("photologue:pl-photo", args=[self.pk])
|
return reverse("photologue:pl-photo", args=[self.pk])
|
||||||
|
|
||||||
def get_download_url(self):
|
def get_download_url(self):
|
||||||
return self.image.url
|
return self.image.url if self.image else ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def file_path(self):
|
def file_path(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue