parent
35458ab391
commit
cb878d3ed8
@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Welcome!</div>
|
||||
<div class="panel-body">
|
||||
Here you can manage your darknet resources!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,67 @@
|
||||
from django.db import models
|
||||
|
||||
from dncore.models import User
|
||||
from .validators import HandleValidator
|
||||
|
||||
class Maintainer(models.Model):
|
||||
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
|
||||
|
@ -0,0 +1,13 @@
|
||||
from django.core import validators
|
||||
from django.utils import six
|
||||
from django.utils.deconstruct import deconstructible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@deconstructible
|
||||
class HandleValidator(validators.RegexValidator):
|
||||
regex = r'^[A-Z]+[0-9]+(-[A-Z]+)'
|
||||
message = _(
|
||||
'Enter a valid handle (all uppercase)'
|
||||
)
|
||||
flags = re.ASCII if six.PY3 else 0
|
||||
|
Loading…
Reference in new issue