parent
d49a3c2774
commit
4303a1d674
@ -0,0 +1,35 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Header</div>
|
||||
<div class="panel-body">
|
||||
{% if mnts %}
|
||||
|
||||
{% else %}
|
||||
You don't have a maintainer! Start by creating a Maintainer and a Person Object!
|
||||
|
||||
<form action="{% url "whoisdb:dashboard" %}" method="post">
|
||||
{% csrf_token %}
|
||||
<h3>Maintainer Object</h3>
|
||||
<small>This object will be used to identify resources you are allowed
|
||||
to edit via your maintainer</small>
|
||||
{{ mntForm | crispy }}
|
||||
|
||||
<h3>Person Object</h3>
|
||||
<small>This object will be used to identify yourself as a person to other people, used for your maintainer object</small>
|
||||
{{ contactForm | crispy }}
|
||||
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,3 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Maintainer, Contact, ASBlock, ASNumber, InetNum
|
||||
|
||||
admin.site.register(Maintainer)
|
||||
admin.site.register(Contact)
|
||||
admin.site.register(ASBlock)
|
||||
admin.site.register(ASNumber)
|
||||
admin.site.register(InetNum)
|
||||
|
@ -0,0 +1,22 @@
|
||||
from django import forms
|
||||
|
||||
#from crispy_forms.helper import FormHelper
|
||||
#from crispy_forms.layout import Submit, Layout
|
||||
#from django.urls import reverse
|
||||
|
||||
from .models import Maintainer, Contact
|
||||
|
||||
class MntForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Maintainer
|
||||
fields = ['handle', 'description']
|
||||
|
||||
class ContactForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Contact
|
||||
fields = ['handle', 'name']
|
||||
|
||||
def __init__(self, person=True, *args, **kwargs):
|
||||
super(ContactForm, self).__init__(*args, **kwargs)
|
||||
# check if this is a person
|
||||
self.person = person
|
@ -0,0 +1,133 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-21 22:40
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import whoisdb.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ASBlock',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('handle', models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()])),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now_add=True)),
|
||||
('description', models.CharField(blank=True, max_length=64)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ASNumber',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('handle', models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()])),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now_add=True)),
|
||||
('number', models.PositiveIntegerField(db_index=True, unique=True)),
|
||||
('volatile', models.BooleanField(default=False)),
|
||||
('description', models.CharField(blank=True, max_length=64)),
|
||||
('asblock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='whoisdb.ASBlock')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Contact',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('handle', models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()])),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now_add=True)),
|
||||
('name', models.CharField(max_length=128)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='InetNum',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('handle', models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()])),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now_add=True)),
|
||||
('protocol', models.CharField(choices=[('ipv4', 'ipv4'), ('ipv6', 'ipv6')], max_length=4)),
|
||||
('netmask', models.PositiveIntegerField()),
|
||||
('description', models.CharField(blank=True, max_length=64)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='maintainer',
|
||||
name='created',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='maintainer',
|
||||
name='handle',
|
||||
field=models.SlugField(default=None, max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()]),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='maintainer',
|
||||
name='last_modified',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='inetnum',
|
||||
name='mnt_lower',
|
||||
field=models.ManyToManyField(to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='inetnum',
|
||||
name='parent_range',
|
||||
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='whoisdb.InetNum'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='contact',
|
||||
name='mnt_by',
|
||||
field=models.ManyToManyField(to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='asnumber',
|
||||
name='mnt_by',
|
||||
field=models.ManyToManyField(to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='asnumber',
|
||||
name='mnt_lower',
|
||||
field=models.ManyToManyField(related_name='lower_asnumber_set', to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='asblock',
|
||||
name='mnt_by',
|
||||
field=models.ManyToManyField(to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='asblock',
|
||||
name='parent_block',
|
||||
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='whoisdb.ASBlock'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='maintainer',
|
||||
name='admin_c',
|
||||
field=models.ManyToManyField(to='whoisdb.Contact'),
|
||||
),
|
||||
]
|
@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-22 18:12
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import whoisdb.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0002_auto_20170221_2240'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='maintainer',
|
||||
name='description',
|
||||
field=models.CharField(blank=True, max_length=64),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asblock',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asnumber',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contact',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='inetnum',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='maintainer',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='name'),
|
||||
),
|
||||
]
|
Loading…
Reference in new issue