My Django project is based on built-in User
model.
For some extra attributes, I have defined another model:
models.py:
class Status(models.Model):
email = models.ForeignKey(User, on_delete=models.CASCADE)
is_verified = models.BooleanField(default=False)
is_active = models.BooleanField(default=False)
def __str__(self):
return self.email
And here's the custom ModelAdmin:
admin.py:
class CustomUserAdmin(UserAdmin):
model = User
list_display = ['email']
search_fields = ['email']
I want list_display
to show me is_verified
and is_active
fields from Status
model but I'm lost.
I've looked into some similar questions on SO like Display field from another model in django admin or Add field from another model Django but none of the solutions are applicable because one of my models is Django's built-in.