See https://code.djangoproject.com/ticket/12663
_meta is in a weird limbo state. It isn't *technically* stable API,
and it isn't documented, but it's *effectively* a stable API -- both
because it hasn't changed in a long time, and there is lots of code in
the wild that would break hard if we changed it.
So - it's one of those things that *should* be documented and
fomalized; it's just waiting on someone with the spare time to do the
job.
There's also a light cleanup required. There are some parts of the
_meta api -- like get_field() -- that are completely uncontroversial,
and would clearly be stabilized as is. However, there are also API
entry points that are more esoteric, and in some cases, are represent
potentially duplicated functionality in the _meta structure. What is
needed is for a motivated someone to do an audit, cleanup, and
documentation of the code that is there.
Yours,
Russ Magee %-)
About as long as this piece of string that I'm holding. Oh, wait - you
can't see the string? Let me hold it up for you... :-)
Seriously -- I can't really answer this. It's not a completely trivial
task, but it's not complex on the order of "multi-db" or "no-sql
support" either. The first step really is an audit -- a rough cut at
documenting everything that is there at the moment. Once we have that,
we can look at how the existing API is being used, and evaluate the
cleanup opportunities.
Once that's done, we'll be in a much better position to evaluation how
much work is involved.
> And what about the extra features I suggested ? A more user-friendly
> way to get all -data- fields (including m2m, excluding pointers), an
> easy way to get the name of the pk field of the first parent.
...
> Or did I miss some methods/properties from the _meta API ?
Off the top of my head, I can't answer this. It's *possible* that
there might be some way to do this, but I'd need to go digging to work
out for sure, and I can't refer to the documentation to find out
easily :-)
However, I wouldn't be at all surprised if it isn't possible. The
_meta API is mostly designed for Django's own internal needs, and
Django needs to make a very clear distinction between fields and
m2m's, forward and reverse fields, and so on; hence the distinctions
that exist in the current API. "Iterating over all fields" doesn't
make much sense from an internal perspective, because different types
of fields need to be handled differently. Similarly, the "hidden" _ptr
fields might not be important from a public visibility perspective,
but they're very important from an internal perspective.
That said, just because Django doesn't have a use for the API doesn't
mean it wouldn't be useful. If you can propose a clean way to augment
the _meta API to provide this sort of capability, I don't see any
fundamental reason why it shoudn't be included.
Yours,
Russ Magee %-)
Let me know how I can help.
> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>
>
--
Justin Holmes
Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330