Django ImageField core=False in newforms admin
-
09-06-2019 - |
Question
In the transition to newforms admin I'm having difficulty figuring out how specify core=False for ImageFields.
I get the following error:
TypeError: __init__() got an unexpected keyword argument 'core'
[Edit] However, by just removing the core argument I get a "This field is required." error in the admin interface on attempted submission. How does one accomplish what core=False is meant to do using newforms admin?
Solution
To get rid of "This field is required," you need to make it not required, by using blank=True (and possibly null=True as well, if it's not a CharField).
OTHER TIPS
The core
attribute isn't used anymore.
From Brian Rosner's Blog:
You can safely just remove any and all
core
arguments. They are no longer used. newforms-admin now provides a nice delete checkbox for exisiting instances in inlines.
This is simple. I started getting this problems a few revisions ago. Basically, just remove the "core=True" parameter in the ImageField in the models, and then follow the instructions here to convert to what the newforms admin uses.