﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18168	formfield_for_choice_field() doesn't validate choices updated in method	Robert <weglarek.robert+djangotrac@…>	nobody	"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."	Bug	closed	contrib.admin	1.3	Normal	fixed	admin, inlines		Accepted	0	0	0	0	0	0
