Skip to content

Instantly share code, notes, and snippets.

@fish2000
Created January 17, 2012 01:29
Show Gist options
  • Save fish2000/1623999 to your computer and use it in GitHub Desktop.
Save fish2000/1623999 to your computer and use it in GitHub Desktop.
Needs moar type system.
from django.db.models.loading import cache
from apps.mercer import models as mx
def print_mf(mf):
print "%15s %20s %20s %20s" % (mf.db_column,mf.column,mf.name,mf.attname)
for modl in [cache.get_model('mercer', mi) for mi in mx.__dict__.keys()]:
if modl is not None and not modl._meta.object_name.lower().startswith('mm'):
print ""
print " --------- %s ----------" % modl._meta.object_name
for mf in modl._meta.fields:
print_mf(mf)
@fish2000
Copy link
Author

[mx for mx in cache.app_models.get('mercer').keys() if mx.lower().startswith('mm')]


from django.db.models.loading import cache
for mxx in [cache.get_model('mercer', mx) for mx in cache.app_models.get('mercer').keys() if mx.lower().startswith('mm')]:
    for mmm in mxx.objects.all():
        print "%4s %20s %20s %20s %20s" % (mmm.id, mmm.fieldname, mmm.display_type, mmm.display_parameters, mmm.display_label)


for mm in mx.MMContacts.objects.all():
    print "%4s %20s %20s %20s %20s" % (mm.id, mm.fieldname, mm.display_type, mm.display_parameters, mm.display_label)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment