-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
We've already got code to delete a file, we just need to make sure we're doing it when cascading down from a deleted challenge.
Lines 429 to 434 in aef1c79
| def destroy(self, request: Request, *args, **kwargs) -> Response: | |
| """If the file was uploaded, delete the FileField on the model first.""" | |
| file: File = self.get_object() | |
| if file.upload: | |
| file.upload.delete(save=False) | |
| return super().destroy(request, *args, **kwargs) |
https://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.CASCADE