Skip to content

Instantly share code, notes, and snippets.

@bernardoduarte
Created February 25, 2019 20:40
Show Gist options
  • Save bernardoduarte/d72040faa6f79e5fafc9525860f32a57 to your computer and use it in GitHub Desktop.
Save bernardoduarte/d72040faa6f79e5fafc9525860f32a57 to your computer and use it in GitHub Desktop.
Deletes all objects from all models from a given app
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