[Answer]-Django at extra_context 'unicode' object does not support item assignment

1👍

That’s not the correct signature for the change_view method. It should be:

def change_view(self, request, object_id, form_url='', extra_context=None):

You’ve missed out the object_id param, so the value (4) is going into extra_context instead.

Remember to update your super call as well.

0👍

please check the super method call, you define a method
change_view,but in super you specified changelist_view, so there is a
mismatched function calls

class ArticleAdmin(admin.ModelAdmin):
def change_view(self, request, extra_context=None):
    extra_context = extra_context or {}
    print extra_context
    extra_context["show_save_as_draft"] = True
    return super(ArticleAdmin, self).change_view(request, extra_context=extra_context)

Also look into this click here

Leave a comment