look here
https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.Field.choices

"... note that choices can be any iterable object – not necessarily a list
or tuple. This lets you construct choices dynamically. But if you find
yourself hacking
choices<https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.Field.choices>to
be dynamic, you’re probably better off using a proper database table
with a 
ForeignKey<https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ForeignKey>.
choices<https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.Field.choices>is
meant for static data that doesn’t change much, if ever. "

See ya!


2013/8/21 Gerd Koetje <deonlinefotogr...@gmail.com>

> Hi all,
>
> How do i populate choices from a model class inside models.py
>
> doenst work:
>
> regio = models.CharField(max_length=100, choices=list(Regio), default=
> 'Amsterdam')
> regio = models.CharField(max_length=100, choices=Regio, default=
> 'Amsterdam')
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Rafael E. Ferrero
Claro: (03562) 15514856

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to