Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View scythargon's full-sized avatar

Dmitry Vasilev scythargon

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import vkontakte
import sys
import ipdb
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()