[Solved]-Cannot list all of my fields in list_editable without causing errors



I understand now. For some reason the official documentation didn’t click with me, however reading this did:

To sum things up:

list_display – is for which fields will appear in the admin page

list_editable – is for which fields can be edited without officially opening them up in the β€œedit” page. you can basically just edit them right there on the spot in-line. pretty awesome.

list_display_links – at least one item from list_display must serve as the link to the edit page. this item can’t also be in list_editable otherwise it couldn’t serve as a link. (facepalm)

This is how I ended up modifying my files:


class Slider(models.Model):
    link = "Edit"


class SliderAdmin(admin.ModelAdmin):
    list_display = (
        'slider_title', 'slider_text', 'slider_order', 'link',)
    list_display_links = ('link',)
    list_editable = ('slider_title', 'slider_text', 'slider_order',)


You have to add:

list_display_links = None


You better create a dummy column in admin.py as shown below instead of creating a dummy field in models.py to make all columns editable in Django Admin:

class SliderAdmin(admin.ModelAdmin):
    # ...
    list_display = (
        'slider_title', 'slider_text', 'slider_order', 'dummy',)
    list_display_links = ('dummy',)
    list_editable = ('slider_title', 'slider_text', 'slider_order',)

    @admin.display(description="") # Here
    def dummy(self, obj):
        return "" 

You can see my post expaining more details about it.

Leave a comment