Open erwinelling opened 3 years ago
Hi @erwinelling
I think the code in with_preview_and_ppoi
assumes that widget
is a widget class and not an instance; maybe you're passing forms.ClearableFileInput()
and not forms.ClearableFileInput
? That being said, ImageField.formfield
already uses ClearableFileInput
by default.
Maybe it works if you do not automatically generate the form field from the model? Is there a reason why you cannot use a default forms.ImageField
in your form (if you do not want the preview and PPOI widget after all)
I am using ImageField on a model and use a Modelform to generate a form.
If I understand correctly, the form automatically uses the widget provided by this package, being ClearableFileInput, with and added preview of the image.
I'd like to use a different widget in my form, but overriding the widget on the form level, fails because it still seems to run this function:
I tried using just forms.ClearableFileInput, and get the error: 'ClearableFileInput' object has no attribute 'name'
I'm having difficulties wrapping my head around where to change or alter the widget. Would you be able to give me some pointers? If you think this hasn't got enough to do with this particular package, I would understand, but I'm not sure.