You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question: does file resubmit work with form.empty_permitted is False? I suspect that when I use the ClearableFileInput, it does not check empty_permitted. Also, I can clear required images in a formset. Thanks for checking!
class Meta:
model = Image
fields = ['image', ]
widgets = {
'image': AdminResubmitImageWidget,
}
class MyInlineFormSet(BaseInlineFormSet):
def init(self, _args, *_kwargs):
super(MyInlineFormSet, self).init(_args, *_kwargs)
for form in self.forms:
form.empty_permitted = False
break # only for first form
Hello,
Thanks for creating django-file-resubmit!
I have a question: does file resubmit work with form.empty_permitted is False? I suspect that when I use the ClearableFileInput, it does not check empty_permitted. Also, I can clear required images in a formset. Thanks for checking!
`
class ImageForm(forms.ModelForm):
def init(self, _args, *_kwargs):
super(ImageForm, self).init(_args, *_kwargs)
self.fields['image'].required = False
class MyInlineFormSet(BaseInlineFormSet):
def init(self, _args, *_kwargs):
super(MyInlineFormSet, self).init(_args, *_kwargs)
for form in self.forms:
form.empty_permitted = False
break # only for first form
ImageFormSet = inlineformset_factory(
Room,
Image,
form = ImageForm,
formset = MyInlineFormSet,
extra = 5,
min_num = 1,
max_num = 5,
validate_min = True,
)
`
The text was updated successfully, but these errors were encountered: