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):
|
||||
if self.poster:
|
||||
path = self.poster.path
|
||||
self.poster.delete()
|
||||
if os.path.exists(path):
|
||||
self.poster.delete()
|
||||
else:
|
||||
self.poster.name = None
|
||||
else:
|
||||
poster= self.path('poster.jpg')
|
||||
path = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
|
||||
|
|
Loading…
Reference in a new issue