extend the device manufacturer model

This commit is contained in:
Andreas Zweili 2020-06-08 16:56:45 +02:00
parent d2784a6534
commit c1abc5a09f
1 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,4 @@
from django.core.validators import RegexValidator
from django.db import models from django.db import models
from core.models import Category, Company from core.models import Category, Company
from customers.models import Customer, Owner, Location from customers.models import Customer, Owner, Location
@ -6,6 +7,13 @@ from nets.models import Net, IpStatus
class DeviceManufacturer(Company): 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: class Meta:
verbose_name_plural = "Device Manufacturers" verbose_name_plural = "Device Manufacturers"