add twitter_handle_validator to accounts/models.py

This commit is contained in:
Trent Palmer 2021-04-18 03:03:54 -07:00
parent f82131855f
commit 82ac0350f3

View File

@ -1,6 +1,12 @@
from django.db import models from django.db import models
from tp.models import UUIDAsIDModel from tp.models import UUIDAsIDModel
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
def twitter_handle_validator(x):
if x[0] != '@':
raise ValidationError('twitter_handle must begin with "@"')
class EmailWhiteList(UUIDAsIDModel): class EmailWhiteList(UUIDAsIDModel):