1👍
✅
Use the correct field classes – in this case, forms.IntegerField
rather than models.IntegerField
. You’ll also need to change your arguments – for instance, override the widget for expiration_month
to be a select
widget, and for the ones where you’re trying to set the max_length you’ll need to pass the maxlength
argument through to the widget instead, and define any validation you want to use.
0👍
If You use fields
in Meta
then You must list expliticly all fields that You want to use, even the ones You are adding to the form, but are not present in the model.
What do You mean by that You can’t change the fields
in Meta
? Can You change the __init__
function on the form? You can also subclass this form and override fields
or __init__
.
- [Answer]-Django dumpdata writes datetimes as nulls
- [Answer]-Working with pending trigger event in Django 1.4
- [Answer]-Django Session with Memcached or ElastiCache, does the Django code need to be changed?
- [Answer]-Django – Creating Objects for models and saving it to MYSQL
Source:stackexchange.com