Created
July 29, 2011 00:24
-
-
Save robo-corg/1112878 to your computer and use it in GitHub Desktop.
Detects what models were used in a django fixture
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
#!/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