Created
February 25, 2019 20:40
-
-
Save bernardoduarte/d72040faa6f79e5fafc9525860f32a57 to your computer and use it in GitHub Desktop.
Deletes all objects from all models from a given app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.apps import apps | |
app_models = apps.get_app_config('app').get_models() | |
for model in app_models: | |
model.objects.all().delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment