Esempio n. 1
0
def _SURVEY_CLASSES():
    from lindy.ticket import forms

    classes = (cls for cls in module_classes(forms) if issubclass(cls, BaseForm))

    return sorted(
        ('{}.{}'.format(cls.__module__, cls.__name__), cls.__name__)
        for cls
        in classes
    )
Esempio n. 2
0
def autoregister_models(models_module):

    for model in module_classes(models_module, lambda m: issubclass(m, Model)):
        # Don't auto-register common imports
        if not any((
            model._meta.abstract,
        )):
            if model in admin.site._registry:
                admin.site.unregister(model)
            admin.site.register(model, model.MODEL_ADMIN)