How to register multiple models with the admin?

admin.site.register has this definition in the library:

def register(self, model_or_iterable, admin_class=None, **options):

so models to be registered can be a single model or iterable object so just use this:

myModels = [models.Project, models.Client, models.About]  # iterable list
admin.site.register(myModels)

I tested this in my site and works perfectly fine.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)