My goal is to make some fields editable in the list view. But the problem is that the fields are determined dynamically using get_list_display. Moveover, I would like to define the elements of the list_editable to be dynamic as well. However, Django does not seem to provide any method like get_editable_list. Is it made deliberately ? How can this be achieved ?
Now my code looks like this:
class MyModelAmdin(admin.ModelAdmin):
list_editable = ('field1')
# change_list_template = "files_changelist.html"
def get_list_display(self, request):
if request.user.is_superuser:
list_display = ('field1', 'field2',)
else:
list_display = ('field1',)
return list_display
Django (justfully) complains that some of the fields which are not included in the list_display are included in the list_editable. Any way ouy?