aboutsummaryrefslogtreecommitdiff
path: root/longusername/models.py
blob: 7268ed62fbe2e6a78829b8c0c6f667f39d62b7f9 (plain)
1
2
3
4
5
6
7
8
9
10
from django.db.models.signals import class_prepared

def longer_username(sender, *args, **kwargs):
    # You can't just do `if sender == django.contrib.auth.models.User`
    # because you would have to import the model
    # You have to test using __name__ and __module__
    if sender.__name__ == "User" and sender.__module__ == "django.contrib.auth.models":
        sender._meta.get_field("username").max_length = 75

class_prepared.connect(longer_username)