On Tue, 2008-08-19 at 06:18 -0700, guillaume wrote:
> Hi Dane,
> 
> Thanks for these informations. Does it mean that a model dynamically
> created will now appear in admin section ?

The previous poster described a way to inspect an existing data source
and print out the model definition to stdout. You will then need to
paste that output into a models file (and possibly edit it, if anything
needs tweaking, which is why any inspectdb-like operations prints out
the result). The model isn't "dynamically created" at all.

It will appear in the admin if you put it into a models file *and* write
an admin class for it, as per normal.

If you really want to dynamically create models, you'll need to poke
around the internals of Django a lot, since that isn't documented
(oustide of docstrings and the code) and isn't public API, so is subject
to change without notice in the future. If you have to ask on this list
how to do that, quite honestly, you probably aren't ready to take that
step, because it does require confidence at reading the source and
understanding it. You'll want to start with
django.db.models.base.ModelBase.__new__ to see how model classes are
created, for example. Reading that will give you an idea of whether
you're going to able to understand the code or not.

And if you do understand that and feel comfortable playing with it --
please feel free to do so. I'm not saying "don't do that." Rather, I'm
cautioning that this is deep internals stuff and if you're looking for
step-by-step instructions or support, you're going to have to adjust
your expectations.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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