Custom Search

Wednesday, August 20, 2014

Django ModelAdmin ActionForm action_checkbox replace id with different field

* Override the method "action_checkbox" of "ModelAdmin" class and change "" with "obj.your_field"

* See django/contrib/admin/ and django/contrib/admin/

class OurModelAdmin(admin.ModelAdmin):

    def action_checkbox(self, obj):
        A list_display column containing a checkbox widget.
        from django.contrib.admin import helpers
        from django.utils.encoding import force_text
        return helpers.checkbox.render(helpers.ACTION_CHECKBOX_NAME, force_text(

No comments:

Post a Comment