Friday, February 4, 2011

Change null representation when you're using choices widget.

Hi
In some choices widgets I want to represent null values as u'No
period' instead of u'--------'

I try with:

PERIOD_CHOICES = getattr(settings, 'PERIOD_CHOICES',
((None,
ugettext('No Period')),
(DAILY, ugettext('Daily')),
(MONTHLY,
ugettext('Monthly')),
(ANUAL, ugettext('Anual')),
))
period = models.CharField(max_length=1,
choices=settings.PERIOD_CHOICES, null=True)

But when I choose "No Period" I get this form validation error: Value
u'None' is not a valid choice.

Any idea?
Thanks!
--
Marc

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment