Thank you very much for your reply. It seems that you understood my question
really well, but the answer is not as simple as I expected... I am trying to
implement something similar. Could you explain a bit more (as I am no Python
Guru)? Can you you point me to the part in the Django source that does that?

Thanks

On Tue, Sep 2, 2008 at 9:44 AM, bruno desthuilliers <
[EMAIL PROTECTED]> wrote:

>
>
>
> On 2 sep, 09:17, Abdallah El Guindy <[EMAIL PROTECTED]>
> wrote:
> > Hey all,
> >
> > Does anyone have an idea how is the syntax of creating a model is
> > implemented in Django...
>
> Yes.
>
> > by that I mean:
> >
> > from django.db import models
> >
> > class Person(models.Model):
> >     first_name = models.CharField(max_length=30)
> >     last_name = models.CharField(max_length=30)
> >
> > The fields are not specified as attributes...
>
> Yeps, they are - as class attributes. The Model's metaclass then
> remove these attributes from the class object itself and store them in
> your model class _meta.fields attribute.
>
> > How can one later get
> > such a sequence for example:
> >
> > [('first_name', 'CharField'), ('last_name', 'CharField')]
>
> [(f.name, f) for f in YourModelClassOrInstance._meta.fields]
>
>
> >
>

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

Reply via email to