Warnings if no mnt present, better imports

This commit is contained in:
Sebastian Lohff 2017-03-27 02:05:57 +02:00
parent 8509821f28
commit e701b4be7f
5 changed files with 31 additions and 3 deletions

View File

@ -45,7 +45,13 @@ def main():
ASBlock.objects.get(handle="TRA1-ASB"),
ASBlock.objects.get(handle="UAB1-ASB")
]
ASNumber
ranges = [
InetNum.objects.get(handle="TRA1-NET"),
InetNum.objects.get(handle="DEF4-NET"),
InetNum.objects.get(handle="DEF6-NET"),
InetNum.objects.get(handle="UNR1-NET"),
InetNum.objects.get(handle="MAIN4-NET"),
]
data = json.load(args.json)
@ -100,6 +106,14 @@ def main():
obj.name = "Imported Network without admin info"
obj.handle = InetNum.genGenericHandle("Unknown Imported Network")
obj.description = "Object has been imported from old DB and has not yet been edited"
for r in ranges:
if network.network_address in r.getNetwork():
obj.parent_range = r
break
else:
raise ValueError("%s did not fit in any netblock" % network)
obj.save()
obj.mnt_by.add(defMnt)

View File

@ -17,7 +17,7 @@ def listRequests(request):
requestedToMe = Request.objects.filter(provider__in=mnts)
requests = (requestedFromMe | requestedToMe).order_by("-lastAction")
return render(request, "rrequests/list.html", {"requests": requests, "requestedFromMe": requestedFromMe, "requestedToMe": requestedToMe})
return render(request, "rrequests/list.html", {"mnts": mnts, "requests": requests, "requestedFromMe": requestedFromMe, "requestedToMe": requestedToMe})
class RrequestCreate(LoginRequiredMixin, FormView):

View File

@ -65,6 +65,7 @@
{% if user.is_authenticated %}
<li><a href="{% url 'user:logout' %}">Logout</a></li>
{% else %}
<li{% if request.resolver_match.url_name == 'register' %} class="active"{%endif%}><a href="{% url "user:register" %}">Register</a></li>
<li{% if request.resolver_match.url_name == 'login' %} class="active"{%endif%}><a href="{% url "user:login" %}">Login</a></li>
{% endif %}
</ul>
@ -81,7 +82,7 @@
<div class="row">
<div class="col-sm-12">
{% for message in messages %}
<div role="alert" class="alert {% if message.tags %}alert-{{ message.tags }} {% endif %}alert-dismissible">{{ message }}</div>
<div role="alert" class="alert {% if message.tags %}alert-{{ message.tags }} {% endif %}alert-dismissible"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>{{ message }}<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>
{% endfor %}
</div>
</div>

View File

@ -8,6 +8,13 @@
<div class="panel panel-default">
<div class="panel-heading">DNS Overview</div>
<div class="panel-body">
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<strong>Warning</strong>: You have no maintainer object. Create one <a class="alert-link" href="{% url "whoisdb:dashboard" %}">here</a> before creating domains.
</div>
<h4>Your Nameservers (<a href="{% url "domains:nameserver-create" %}">New nameserver</a>)</h4>
<table class="table">
<tr>

View File

@ -8,6 +8,12 @@
<div class="panel panel-default">
<div class="panel-heading">Resource Requests</div>
<div class="panel-body">
{% if not mnts.count %}
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<strong>Warning</strong>: You have no maintainer object. Create one <a class="alert-link" href="{% url "whoisdb:dashboard" %}">here</a> before starting resource requests.
</div>
{% endif %}
<p>
<a href="{% url "rrequests:create" %}">Start a new request for resources</a>
</p>