1👍
✅
IMO you should definitely move it in your DB. Manually maintained lists might seem a good idea now but are not scalable and will inevitably cause headaches later on.
The easiest approach is to create a UserProfile
model (see docs) that can be used to store this and any other user information:
from django.conf import settings
class Profile(models.Model):
# Tie this profile to a specific user.
# You may need to set null=True if migrating a bunch of existing users
# who don't have a profile.
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
verified = models.BooleanField(default=False)
Then you can access this from anywhere using the standard reverse relationships:
{% if person.profile.verified %}
<span style="color:orange;"><b>*</b></span>
{% endif %}
You should also make sure you add the appropriate select_related
calls to your querysets so that the users and profile are fetched in the same DB query.
Source:stackexchange.com