10 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
12 from django.db.models.fields.related import ForeignKey
13 from core.models import *
24 if type(c)==type(PlCoreBase):
25 model_classes.append(c)
26 class_names.append(c.__name__)
30 print "digraph plstack {";
31 for c in model_classes:
32 fields = c._meta.fields
34 if type(f)==ForeignKey and f.name.title() in class_names:
35 print '\t"%s"->"%s";'%(c.__name__,f.name.title())
37 elif (output=='-json'):
39 for c in model_classes:
40 fields = c._meta.fields
42 if type(f)==ForeignKey and f.name.title() in class_names:
44 d[c.__name__].append(f.name.title())
46 d[c.__name__]=[f.name.title()]
47 print json.dumps(d,indent=4)