forked from 0x2620/pandora
check if it poster exists
This commit is contained in:
parent
38abce6033
commit
d11eacd8ba
1 changed files with 4 additions and 1 deletions
|
@ -893,7 +893,10 @@ class Item(models.Model):
|
||||||
def delete_poster(self):
|
def delete_poster(self):
|
||||||
if self.poster:
|
if self.poster:
|
||||||
path = self.poster.path
|
path = self.poster.path
|
||||||
|
if os.path.exists(path):
|
||||||
self.poster.delete()
|
self.poster.delete()
|
||||||
|
else:
|
||||||
|
self.poster.name = None
|
||||||
else:
|
else:
|
||||||
poster= self.path('poster.jpg')
|
poster= self.path('poster.jpg')
|
||||||
path = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
|
path = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
|
||||||
|
|
Loading…
Reference in a new issue