On Jun 2, 4:53 pm, ryan <[email protected]> wrote:
> This additional model, which uses the same choices is emptying the
> choices dropdown of both User with inline UserProfile and UserProfile
> itself. Add it prior to UserProfile in models.py of your test app:
>
> class Person(models.Model):
> sales_team = models.IntegerField(choices=SALES_TEAM_CHOICES)
> user_class = models.IntegerField(choices=USER_CLASS_CHOICES)
> last_name = models.CharField(max_length=40)
> first_name = models.CharField(max_length=30)
>
> This behavior is not mentioned as a caveat
> inhttp://docs.djangoproject.com/en/dev/ref/models/fields/#choices
>
> ryan
Because enumerate() is an iterator. So it is consumed the first time
it is run.
You could call list() on it to flatten it:
SALES_TEAM_CHOICES = list(enumerate(('CLS','CCS','TPS')))
I've never heard of anyone doing this, which is presumably why it's
not mentioned in the documentation...
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---