#18168: formfield_for_choice_field() doesn't update choices declared in model -------------------------------------------------+------------------------- Reporter: Robert | Owner: nobody <weglarek.robert+djangotrac@…> | Status: new Type: Bug | Version: 1.3 Component: contrib.admin | Keywords: Severity: Normal | Has patch: 0 Triage Stage: Unreviewed | UI/UX: 0 Easy pickings: 0 | -------------------------------------------------+------------------------- Having field declared in model: {{{ element = models.CharField(max_length=500, verbose_name=_('admin element'), choices=(('foo', 'bar'),)) }}} and that function in admin: {{{ class AdminModuleElementInline(admin.StackedInline): model = AdminModuleElement def formfield_for_choice_field(self, db_field, request=None, **kwargs): if db_field.name == 'element': kwargs['choices'] = ( ('accepted', 'Accepted'), ('denied', 'Denied'), ) return db_field.formfield(**kwargs) }}} when I try to save it I get an error: ''Value u'accepted' is not a valid choice.''
So it updates the list, but validator checks the choices declared in model. -- Ticket URL: <https://code.djangoproject.com/ticket/18168> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.