mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 13:15:18 +02:00
added-fix-image-deletion
This commit is contained in:
parent
71ff217323
commit
0a3ca75dd0
1 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,7 @@ from adventures.serializers import AdventureImageSerializer
|
|||
from integrations.models import ImmichIntegration
|
||||
import uuid
|
||||
import requests
|
||||
import os
|
||||
|
||||
class AdventureImageViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = AdventureImageSerializer
|
||||
|
@ -150,6 +151,9 @@ class AdventureImageViewSet(viewsets.ModelViewSet):
|
|||
|
||||
def perform_destroy(self, instance):
|
||||
print("perform_destroy")
|
||||
if instance.image:
|
||||
if os.path.isfile(instance.image.path):
|
||||
os.remove(instance.image.path)
|
||||
return super().perform_destroy(instance)
|
||||
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue