I have a model like this:
class CustomUser(AbstractUser):
@property
def is_paid(self):
return self.apayment4thisuser.all().filter(expirydate__gt=timezone.now().date()).count()>0
In the customadmin I am able to add is_paid in list_display, but it is throwing error when I add it to my list_filter:
class CustomUserAdmin(UserAdmin):
model = CustomUser
list_filter = ['app_user','is_paid']
list_display = ['id',
'username',
'email',
'is_paid',
]
This is the error:
ERRORS:
<class 'users.admin.CustomUserAdmin'>: (admin.E116) The value of 'list_filter[1]' refers to 'is_paid', which does not refer to a Field.
Is there not any way to add this to list_filter?