Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Django pseudonymization example (1) - User queryset
from django.db import models
from django.core.validators import RegexValidator
from django.contrib.auth.models import AbstractUser, UserManager as AuthUserManager
from app.utils import mask, unmask
class UserQuerySet(models.QuerySet):
class UserManager(AuthUserManager):
def get_queryset(self):
return UserQuerySet(self.model)
class User(AbstractUser):
# ...
objects = UserManager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment