Second revision of Domain model draft

This commit is contained in:
Seamus Johnston 2022-11-17 07:50:28 -06:00
parent 523c699865
commit 2b91a3c1d1
No known key found for this signature in database
GPG key ID: 2F21225985069105
12 changed files with 561 additions and 33 deletions

View file

@ -0,0 +1,30 @@
from django.db import models
from django.core.validators import validate_ipv46_address
from .utility.time_stamped_model import TimeStampedModel
from .host import Host
class HostIP(TimeStampedModel):
"""
Hosts may have one or more IP addresses.
The registry is the source of truth for this data.
This model exists ONLY to allow a new registrant to draft DNS entries
before their application is approved.
"""
address = models.CharField(
max_length=46,
null=False,
blank=False,
default=None, # prevent saving without a value
validators=[validate_ipv46_address],
help_text="IP address",
)
host = models.ForeignKey(
Host,
on_delete=models.PROTECT,
help_text="Host to which this IP address belongs",
)