Skip to content

Instantly share code, notes, and snippets.

@robo-corg
Created July 29, 2011 00:24
Show Gist options
  • Save robo-corg/1112878 to your computer and use it in GitHub Desktop.
Save robo-corg/1112878 to your computer and use it in GitHub Desktop.
Detects what models were used in a django fixture
#!/usr/bin/env python
import json
import sys
# useful when used with backticks like: python manage.py dumpdata --indent=4 `fixture_models your_fixture.json`
data = None
with open(sys.argv[1]) as json_file:
data = json.load(json_file)
models = set()
for model in data:
models.add(model['model'])
print ' '.join(models)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment