from django.db import models
# importing validationerror
from django.core.exceptions import ValidationError
# creating a validator function
def validate_geeks_mail(value):
if "@gmail.com" in value:
return value
else:
raise ValidationError("This field accepts mail id of google only")
# Create your models here.
class GeeksModel(models.Model):
geeks_mail = models.CharField(
max_length = 200,
validators =[validate_geeks_mail]
)
Code Example |
---|
Python :: |
Python :: |
:: |
Python :: |
:: |
:: pivot index |
Python :: |
:: python dynamic variable name |
Python :: python how to exit function |
:: |
Python :: get index of first true value numpy |
:: |
Python :: |
Python :: set default palette seaborn |
:: |
:: |
Python :: for i in range |
:: |
:: python program to calculate the average of numbers in a given list |
:: take columns to rows in pandas |
:: |
:: |
Python :: python math exp |
:: |
Python :: python list equality |
:: |
Python :: python online compiler |
:: Example of floor method in python |
:: |
Python :: test pypi |