From 82ac0350f31f31fac2a7462b10577bce8b85150a Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Sun, 18 Apr 2021 03:03:54 -0700 Subject: [PATCH] add twitter_handle_validator to accounts/models.py --- accounts/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accounts/models.py b/accounts/models.py index de6107d..b535545 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,6 +1,12 @@ from django.db import models from tp.models import UUIDAsIDModel 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):