Skip to content

Instantly share code, notes, and snippets.

View gist:9949835
def get_chained_select_choices(content_type, depth=1, with_field_types=False):
""" Gets field names from the content_type.
depth=1 means return any fk or manytomany fields as well
TODO: depth>1 is not implemented yet
"""
if depth > 1:
raise Exception("depth should be 0 or 1")
# helpers
model_klass = content_type.model_class()