On 9 March 2010 10:31, andrew_scfc <[email protected]> wrote: > Hi, > > I'm new to using Django and have come across some redundancy in my > implementation that I would like to irradicate. > > I have defined several models in the models.py file as normal. I would > like to register all of my models to be available via the admin > interface. Currently I need to register models one by one in the > admin.py as show below: > > from mysite.models import model1, model2, model3, model4, model5 > from django.contrib import admin > > admin.site.register(model1) > admin.site.register(model2) > admin.site.register(model3) > admin.site.register(model4) > admin.site.register(model5) > > > Is it possible to just register all models? Perhaps get hold of a > collection containing all the models. I am quite new to python so I > may have missed something quite simple, if so, I apologise. > > Cheers > Andy > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > >
models = [model1, model2, model3, model4, model5] admin.site.register(models) This should work i think. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

