Introduction
By registering a class for further access in Django administrator page, sometimes it will stumble upon several error. The error appear in the following error messages :
SystemCheckError: System check identified some issues: ERRORS: <class 'org.admin.UnitAdmin'>: (admin.E107) The value of 'list_display' must be a list or tuple.
So, the above error message appear because of the following circumstances :
-
There is already a running Django-based application.
-
Following after, this Django-based application or project by default already has an admin functional or feature built-in it. It exist in the ‘settings.py’ file of the project as in the following configuration definition :
# Application definition INSTALLED_APPS = [ 'django.contrib.admin', ... ]
The entry which is supporting the admin functional or feature are the package library of ‘django.contrib.admin’.
-
In order to implement the admin functional or feature, just create a new file with the name of ‘admin.py’ in the root folder of the application. Register or define the class where their associated data will be maintained in the admin page. For an example, in this one, there is a class with the following syntax :
class UnitAdmin(MPTTModelAdmin): list_display = ('id') admin.site.register(UnitAdmin)
Apparently, running a Django internal service using ‘python manage.py runserver’ triggering the above error to appear.
Solution
Then again, this is a simple mistakes when defining a class for further register process. Defining the class where there will be a need to list what are the fields for displaying it in the admin page comes with a certain format or pattern. As in the error message appear, it need to be defined in a list or tuple. That information exist in the error message of
The value of 'list_display' must be a list or tuple.
. So, in order to solve the problem, just change the format or the pattern definition of ‘list_display’ into a list or tuple form. The following below is the correction of the format or pattern of the ‘list_display’ :
class UnitAdmin(MPTTModelAdmin): list_display = ['id'] admin.site.register(UnitAdmin)
Just change it from the round braced or round bracket into a square braced or square bracket as in the above definition for the ‘list_display’ variable. Run it once more, if there are no more errors appear, the application will run normally.