admin.ModelAdmin.get_changelist_formset()

ModelAdmin.get_changelist_formset(request, **kwargs) [source]

Returns a ModelFormSet class for use on the changelist page if list_editable is used. To use a custom formset, for example:

1
2
3
4
5
6
7
8
9
from django.forms import BaseModelFormSet
 
class MyAdminFormSet(BaseModelFormSet):
    pass
 
class MyModelAdmin(admin.ModelAdmin):
    def get_changelist_formset(self, request, **kwargs):
        kwargs['formset'] = MyAdminFormSet
        return super(MyModelAdmin, self).get_changelist_formset(request, **kwargs)
doc_Django
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.