mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
10 lines
351 B
Python
10 lines
351 B
Python
from urllib.parse import urlparse
|
|
from django.core.exceptions import ValidationError
|
|
|
|
|
|
def validate_url(value):
|
|
if not value:
|
|
return # Required error is done the field
|
|
obj = urlparse(value)
|
|
if obj.hostname not in ('nottinghamtec.sharepoint.com'):
|
|
raise ValidationError('URL must point to a location on the TEC Sharepoint') |