Add endpoint to get user list for a preference
The endpoint includes the key of the desired preference in the URL and returns the list of users for whom the preference is set (regardless of the value).
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
|
||||
|
||||
class UserPreference(models.Model):
|
||||
"""A user's preference, stored as generic text to be processed by client"""
|
||||
KEY_REGEX = r"[-_a-zA-Z0-9]+"
|
||||
user = models.ForeignKey(User, db_index=True, related_name="preferences")
|
||||
key = models.CharField(max_length=255, db_index=True)
|
||||
key = models.CharField(max_length=255, db_index=True, validators=[RegexValidator(KEY_REGEX)])
|
||||
value = models.TextField()
|
||||
|
||||
class Meta:
|
||||
|
||||
Reference in New Issue
Block a user