I have models.py file as follows.
from django.db import models
class UpdateCreateModelMixin:
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class Question(UpdateCreateModelMixin, models.Model):
name = models.CharField(max_length=100)
code = ...
... (Some more field)
How do I display the updated, created fields in the Django model Admin, my admin.py file is
from django.contrib import admin
from .models import Question
class QuestionAdmin(admin.ModelAdmin):
list_display = ('name', 'created', 'updated')
list_filter = ('created')
admin.site.register(Question, QuestionAdmin)
For the above admin.py file I am getting this error.
<class 'assignments.admin.QuestionAdmin'>: (admin.E116) The value of 'list_filter[0]' refers to 'created', which does not refer to a Field.
So, how do I add an inherited fields in the django model Admin and why is the above failing?