I'm trying to have the django admin display a model form with dynamically 
generated fields. I setup my form like this:

class EulogyTextForm(f.ModelForm):
    class Meta:
        model = EulogyText
        fields = '__all__'

    def __init__(self, *args, **kwargs):
        super(EulogyTextForm, self).__init__(*args, **kwargs)

        for i in range(len(settings.MULTITEXT_LANGUAGES)):
            field_name = 'language%s' % (i, )
            self.base_fields[field_name] = f.CharField(disabled=True, 
initial=settings.MULTITEXT_CHOICES[i][0])
            field_name += '_text'
            self.base_fields[field_name] = f.CharField()


I have setup my admin like this:
class EulogyTextAdmin(admin.ModelAdmin):
    model = EulogyText
    exclude = []
    form = EulogyTextForm



However, Django admin will not display my added fields. I have created a 
TestView to display the form. In the test view, the form is correctly 
displayed with the added fields. Why does Django admin ignore the 
additional fields?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2531f186-cd20-41c3-a01d-a2f2bfbb440eo%40googlegroups.com.

Reply via email to