I can write a short overview:
   Each model field(or form field) is marked by special counter while
model(or form) is loading. Then in metaclass fields are sorted by that
counter.

I've recently written the blog post about this staff but its in
Russian language. Overwise you can look at code snippet(first and
second ones) that exists there:
http://webnewage.org/2009/1/10/prinuzhdenie-k-poryadku/

On Mon, Jan 12, 2009 at 12:19 AM, dauerbaustelle <[email protected]> wrote:
>
> Hi there,
>
> I'm writing some python stuff using metaclasses. I use declarative
> syntax like django's db.models.Model and the dict is catched by some
> metaclass __init__ method. My Problem is, that, unfortunately, the
> order of the variables I get is not the same as the order the
> variables I set:
>
> class FooBar(Parent):
>    foo = blah
>    bar = blubb
>    bizz = peng
>    buzz = pumm
>
> will end in something like
> {'bizz' : peng, 'bar' : blubb, 'foo' : blah, 'buzz' : pumm}
>
> As I can see, django's models.Model metaclass manages the vars in the
> right order (as one can see at the admin webinterface) - this is
> confusing me... dict's aren't sorted types, so who do you do this?
>
> Would be nice to know ;-)
>
>  - dauerbaustelle
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to