def register(self, model_or_iterable, controller_class=None, **options):
"""
Registers the given model(s) with the given controller class.
The model(s) should be Model classes, not instances.
If a controller class isn't given, it will use Controller (the default
options). If keyword arguments are given -- e.g., list_display --
they'll be applied as options to the controller class.
If a model is already registered, this will raise AlreadyRegistered.
If a model is abstract, this will raise ImproperlyConfigured.
"""
from django.db.models.base import ModelBase
if not controller_class:
from .controller import Controller
controller_class = Controller
if isinstance(model_or_iterable, ModelBase):
model_or_iterable = [model_or_iterable]
for model in model_or_iterable:
super(Backend, self).register(controller_class, model, **options)
评论列表
文章目录