From c1abc5a09fbf9db58665eb0268c4ec18de379d8a Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 8 Jun 2020 16:56:45 +0200 Subject: [PATCH] extend the device manufacturer model --- devices/models/device.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devices/models/device.py b/devices/models/device.py index 4e916dd..913a5ac 100644 --- a/devices/models/device.py +++ b/devices/models/device.py @@ -1,3 +1,4 @@ +from django.core.validators import RegexValidator from django.db import models from core.models import Category, Company from customers.models import Customer, Owner, Location @@ -6,6 +7,13 @@ from nets.models import Net, IpStatus class DeviceManufacturer(Company): + phone_regex = RegexValidator( + regex=r'^\+?1?\d{9,15}$', + message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.") + phone_number = models.CharField(validators=[phone_regex], max_length=17, + blank=True, null=True) + email_address = models.EmailField(null=True, blank=True) + website = models.URLField(null=True, blank=True) class Meta: verbose_name_plural = "Device Manufacturers"