dnmgmt/whoisdb/models_crap.py

68 lines
1.5 KiB
Python

from django.db import models
from dncore.models import User
from .validators import HandleValidator
class ExtraFields(models.Model):
name = models.CharField(max_length=64)
value = models.CharField(max_length=128)
order = models.PositiveSmallIntegerField()
class WhoisObject(models.Model):
handle_suffix = None
whois_fields = None
whois_extra_field_names = None
handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()])
created = models.DateTimeField(auto_add_now=True)
last_modified = models.DateTimeField(auto_add_now=True)
class Meta:
abstract = True
class Maintainer(WhoisObject):
auth = models.ManyToManyField(User)
admin_c = models.ManyToManyField("Contact")
class MntdObject(WhoisObject):
mnt_by = models.ManyToManyField(Maintainer)
class Meta:
abstract = True
class Contact(MntdObject):
TYPE = (('person', 'person'), ('role', 'role'))
name = models.CharField(max_length=128)
class MntdCObject(MntdObject)
admin_c = models.ManyToManyField("Contact")
class Meta:
abstract = True
class MntdObject(WhoisObject):
admin_c = models.ManyToManyField(Contact)
mnt_by = models
class Meta:
abstract = True
class ASNumber(WhoisObject):
number = models.PositiveIntegerField(unique=True, db_index=True)
class InetNum(WhoisObject):
PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6'))
protocol = models.CharField(max_length=4, choices=PROTO)
netmask = models.PositiveIntegerField()
#class ASBlock(WhoisObject):
# pass