parent
e3311a6df7
commit
814a8b62cb
@ -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">Header</div>
|
||||
<div class="panel-body">
|
||||
{{ contact }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,13 @@
|
||||
{% with "whoisdb:"|add:prefix|add:"-detail" as detailView %}
|
||||
{% with "whoisdb:"|add:prefix|add:"-delete" as deleteView %}
|
||||
{% with "whoisdb:"|add:prefix|add:"-edit" as editView %}
|
||||
<tr>
|
||||
<td><a href="{% url detailView obj.handle %}">{{ obj.handle }}</a></td>
|
||||
<td>{{ objType }}</td>
|
||||
<td>{{obj.name }}{{ obj.description }}</td>
|
||||
<td>{% for contact in obj.admin_c.all %}<a href="{% url "whoisdb:contact-detail" contact.handle %}">{{ contact }}</a> {% endfor %}</td>
|
||||
<td><a href="{% url editView obj.handle %}">Edit</a> <a href="{% url deleteView obj.handle %}">Delete</a></td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
@ -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">Header</div>
|
||||
<div class="panel-body">
|
||||
{{ mnt }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,21 @@
|
||||
{% 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">
|
||||
<form method="post" action="#">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,21 @@
|
||||
{% 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">
|
||||
<form method="post" action="#">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,32 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-{% if reasons %}danger{%else%}default{%endif%}">
|
||||
<div class="panel-heading">Header</div>
|
||||
<div class="panel-body">
|
||||
{% if reasons %}
|
||||
<p>
|
||||
You cannot delete this object, as other objects in the database depend on it!
|
||||
</p>
|
||||
<p>
|
||||
<ul>
|
||||
{% for reason in reasons %}
|
||||
<li>{{ reason }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<form method="post" action="#">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,21 @@
|
||||
{% 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">
|
||||
<form method="post" action="#">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,26 @@
|
||||
from django.views.generic import DeleteView
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.contrib import messages
|
||||
|
||||
class DeleteCheckView(DeleteView):
|
||||
""" Check if object actually can be deleted. Provide reasons to template
|
||||
if not.
|
||||
"""
|
||||
def delete(self, request, *args, **kwargs):
|
||||
self.object = self.get_object()
|
||||
success_url = self.get_success_url()
|
||||
|
||||
reasons = self.object.getNoDeleteReasons()
|
||||
if reasons:
|
||||
# do not delete, do what get does...
|
||||
return self.get(request, *args, **kwargs)
|
||||
else:
|
||||
self.object.delete()
|
||||
messages.info(request, "Object %s has been deleted" % self.object.handle)
|
||||
return HttpResponseRedirect(success_url)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
if 'reasons' not in kwargs:
|
||||
kwargs['reasons'] = self.object.getNoDeleteReasons()
|
||||
return super(DeleteCheckView, self).get_context_data(**kwargs)
|
||||
|
@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-28 10:41
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import whoisdb.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0003_auto_20170222_1812'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contact',
|
||||
name='type',
|
||||
field=models.CharField(choices=[('person', 'person'), ('role', 'role')], default='person', max_length=10),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asblock',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='handle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asnumber',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='handle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contact',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='handle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='inetnum',
|
||||
name='handle',
|
||||
field=models.SlugField(max_length=32, unique=True, validators=[whoisdb.validators.HandleValidator()], verbose_name='handle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='maintainer',
|
||||
name='description',
|
||||
field=models.CharField(blank=True, help_text='Short description what this maintainer is for', max_length=64),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='maintainer',
|
||||
name='handle',
|
||||
field=models.SlugField(help_text='Must end with -MNT, eg FOO3-MNT', max_length=32, unique=True, validators=[whoisdb.validators.HandleValidatorWithSuffix('MNT')], verbose_name='handle'),
|
||||
),
|
||||
]
|
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-28 14:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0004_auto_20170228_1041'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='inetnum',
|
||||
name='address',
|
||||
field=models.GenericIPAddressField(db_index=True, default='10.0.0.0'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='contact',
|
||||
name='type',
|
||||
field=models.CharField(choices=[('person', 'PERSON')], max_length=10),
|
||||
),
|
||||
]
|
@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-28 14:40
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0005_auto_20170228_1435'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='inetnum',
|
||||
name='mnt_by',
|
||||
field=models.ManyToManyField(to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asnumber',
|
||||
name='mnt_lower',
|
||||
field=models.ManyToManyField(blank=True, related_name='lower_asnumber_set', to='whoisdb.Maintainer'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='inetnum',
|
||||
name='mnt_lower',
|
||||
field=models.ManyToManyField(blank=True, related_name='lower_inetnum_set', to='whoisdb.Maintainer'),
|
||||
),
|
||||
]
|
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-28 15:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('whoisdb', '0006_auto_20170228_1440'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='asblock',
|
||||
name='mnt_lower',
|
||||
field=models.ManyToManyField(blank=True, related_name='lower_asblock_set', to='whoisdb.Maintainer'),
|
||||
),
|
||||
]
|
Loading…
Reference in new issue