Add URLField for linking to uploaded quotes

This commit is contained in:
2022-12-16 14:48:54 +00:00
parent 8393e85b74
commit 63a2f6d47b
9 changed files with 28 additions and 35 deletions

10
RIGS/validators.py Normal file
View File

@@ -0,0 +1,10 @@
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')