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
classImageInlineFormSet(BaseInlineFormSet):
defclean(self):
super(ImageInlineFormSet, self).clean()
ifnotself.forms:
raiseValidationError("Please add at least one post image.")
classImageInline(SortableInlineAdminMixin, admin.TabularInline):
model=Imageformset=ImageInlineFormSetclassPostAdmin(admin.ModelAdmin):
model=Postinlines= (ImageInline,)
Here's the problem:
When I try to add an image in ProductAdmin, I have to set sort manually.
This is not a serious problem, but I think that there is a better way.
A solution is to add adminsortable2.admin.CustomInlineFormSetMixin to ImageInlineFormSet.
The ordering column is not hidden with custom formset.
For example:
models.py
admin.py
Here's the problem:
When I try to add an image in ProductAdmin, I have to set
sort
manually.This is not a serious problem, but I think that there is a better way.
A solution is to add
adminsortable2.admin.CustomInlineFormSetMixin
to ImageInlineFormSet.admin.py
But 'CustomInlineFormSetMixin' is not declared in
__all__
.So this is not a recommended method.
I want to know the best way.
The text was updated successfully, but these errors were encountered: