def __init__(self, dj_settings, app_label, model_name): super(DjangoModelEmitter, self).__init__() from saucebrush.utils import get_django_model self._dbmodel = get_django_model(dj_settings, app_label, model_name) if not self._dbmodel: raise Exception("No such model: %s %s" % (app_label, model_name))
def __init__(self, dj_settings, app_label, model_name): dbmodel = utils.get_django_model(dj_settings, app_label, model_name) # only get values defined in model (no extra fields from custom manager) self._data = dbmodel.objects.values(*[f.name for f in dbmodel._meta.fields])