Let say I have a model which has a profile pic image field.As a user I uploaded a profile pic.When I upload a new profile pic, old profile has to get deleted. How to handle this scenario in development and production stage
Asked
Active
Viewed 375 times
0
-
could you please attach some code. FG: `viewsets.py`, `serializer.py`, `models.py` – Phoenix Sep 12 '19 at 19:31
1 Answers
0
Use django-cleanup
, it automatically deletes unnecessary files from server.
pip install django-cleanup
And add it to your settings.py
:
INSTALLED_APPS = [
...
'django_cleanup'
]
Possible duplicate of: https://stackoverflow.com/a/28986357/7320045

Osman Omar
- 433
- 1
- 7
- 19