I have a problem with ModelForm
. Field test1
is displayed, but test2
- is not. Playing with base_fields
didn't help.
# models.py
class Country(models.Model):
name = CharField(max_length=100)
# admin.py
class CountryAdminForm(ModelForm):
test1 = forms.CharField('test1')
def __init__(self, *args, **kwargs):
super(CountryAdminForm, self).__init__(*args, **kwargs)
self.fields['test2'] = forms.CharField('test2')
class Meta:
model = Country
class CountryAdmin(admin.ModelAdmin):
form = CountryAdminForm
admin.site.register(Country, CountryAdmin)
Thank you.
Solved!
...