On Sep 26, 1:53 pm, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
>
> # relative import is simpler and safer
> import models
>
> # using introspection
> from django.db.models import Model
> for name in dir(models):
>     obj = getattr(models, name)
>     if obj is not Model and issubclass(obj, Model):
>        try:
>             admin.site.register(obj)
>        except AlreadyRegistred:
>              # XXX : not sure about this is the exact exception type,
>              # but you should be able to find this out easily
>              pass
>

Got this error trying that...

issubclass() arg 1 must be a class

> > b.t.w. I presume the
>
> >     class Admin:
> >             pass
>
> > in the Models.py is useless now...
>
> Definitevely. And that's a GoodThing(tm), since it has nothing to do
> in the models.

I can understand why, but is seems like we've made more work from
something that was simple.

Though I suspect the admin.py can now do way more to modify the admin
than previously.

Lance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to