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