split off add host / add domain view from hosts overview / domains overview
This commit is contained in:
parent
7c5260a6da
commit
c6bdd34fee
33
nsupdate/main/templates/main/domain_add.html
Normal file
33
nsupdate/main/templates/main/domain_add.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}{% load bootstrap %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Add a new Domain" %}</h3>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Add" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Help" %}</h3>
|
||||
<p>
|
||||
{% blocktrans %}Here you can add new domains (zones) which you control (and this is only useful if you
|
||||
have some own zone which you can update automatically).{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}You need to be able to configure the primary master nameserver of the zone so it accepts
|
||||
dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct update secret is presented.{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans "We'll show you configuration examples after you add a domain." %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -4,7 +4,10 @@
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>{% trans "Domains (yours first, then public)" %}</h3>
|
||||
<h3>
|
||||
{% trans "Domains (yours first, then public)" %}
|
||||
<a href="{% url 'add_domain' %}" class="btn btn-primary">{% trans "Add Domain" %}</a>
|
||||
</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -40,34 +43,4 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Add a new Domain" %}</h3>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Add" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Help" %}</h3>
|
||||
<p>
|
||||
{% blocktrans %}Here you can add new domains (zones) which you control (and this is only useful if you
|
||||
have some own zone which you can update automatically).{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}You need to be able to configure the primary master nameserver of the zone so it accepts
|
||||
dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct update secret is presented.{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans "We'll show you configuration examples after you add a domain." %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
48
nsupdate/main/templates/main/host_add.html
Normal file
48
nsupdate/main/templates/main/host_add.html
Normal file
@ -0,0 +1,48 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}{% load bootstrap %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Create a new Host" %}</h3>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Create" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Help" %}</h3>
|
||||
<p>{% trans "Here you can add new hosts (like routers, PCs, servers, ...)." %}
|
||||
</p>
|
||||
<p>{% blocktrans %}You need to be able to configure one of your machines so it sends dyndns2 compatible
|
||||
updates to us when your IP changes. Routers usually have some builtin software that does
|
||||
this, but you can also use some software on another system (like a PC or server).{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}Just make sure your update client either is customizable well enough or has specific
|
||||
support for our service.{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans "We'll show you configuration examples after you add a host." %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Your current IP(s) + reverse DNS:" %}</h3>
|
||||
<p>
|
||||
<b>IPv4:</b> <span id="ipv4" class="ipv4addr">{{ request.session.ipv4 }}</span>
|
||||
<br>
|
||||
<b>rDNS:</b> <span id="ipv4_rdns" class="ipv4addr">{{ request.session.ipv4_rdns }}</span>
|
||||
</p>
|
||||
<p>
|
||||
<b>IPv6:</b> <span id="ipv6" class="ipv6addr">{{ request.session.ipv6 }}</span>
|
||||
<br>
|
||||
<b>rDNS:</b> <span id="ipv6_rdns" class="ipv6addr">{{ request.session.ipv6_rdns }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -4,7 +4,10 @@
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>{% trans "Your Hosts" %}</h3>
|
||||
<h3>
|
||||
{% trans "Your Hosts" %}
|
||||
<a href="{% url 'add_host' %}" class="btn btn-primary">{% trans "Add Host" %}</a>
|
||||
</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -58,49 +61,4 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Create a new Host" %}</h3>
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Create" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Help" %}</h3>
|
||||
<p>{% trans "Here you can add new hosts (like routers, PCs, servers, ...)." %}
|
||||
</p>
|
||||
<p>{% blocktrans %}You need to be able to configure one of your machines so it sends dyndns2 compatible
|
||||
updates to us when your IP changes. Routers usually have some builtin software that does
|
||||
this, but you can also use some software on another system (like a PC or server).{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}Just make sure your update client either is customizable well enough or has specific
|
||||
support for our service.{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans "We'll show you configuration examples after you add a host." %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Your current IP(s) + reverse DNS:" %}</h3>
|
||||
<p>
|
||||
<b>IPv4:</b> <span id="ipv4" class="ipv4addr">{{ request.session.ipv4 }}</span>
|
||||
<br>
|
||||
<b>rDNS:</b> <span id="ipv4_rdns" class="ipv4addr">{{ request.session.ipv4_rdns }}</span>
|
||||
</p>
|
||||
<p>
|
||||
<b>IPv6:</b> <span id="ipv6" class="ipv6addr">{{ request.session.ipv6 }}</span>
|
||||
<br>
|
||||
<b>rDNS:</b> <span id="ipv6_rdns" class="ipv6addr">{{ request.session.ipv6_rdns }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -6,8 +6,8 @@ from django.conf.urls import patterns, url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from .views import (
|
||||
HomeView, OverviewView, HostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
|
||||
RobotsTxtView, DomainOverviewView, DomainView, DeleteDomainView, StatusView, JsUpdateView,
|
||||
HomeView, OverviewView, HostView, AddHostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
|
||||
RobotsTxtView, DomainOverviewView, DomainView, AddDomainView, DeleteDomainView, StatusView, JsUpdateView,
|
||||
UpdaterHostConfigOverviewView, UpdaterHostConfigView, DeleteUpdaterHostConfigView, CustomTemplateView)
|
||||
from ..api.views import (
|
||||
myip_view, DetectIpView, AjaxGetIps, NicUpdateView, AuthorizedNicUpdateView,
|
||||
@ -27,8 +27,10 @@ urlpatterns = patterns(
|
||||
url(r'^status/$', StatusView.as_view(), name='status'),
|
||||
url(r'^generate_secret/(?P<pk>\d+)/$', GenerateSecretView.as_view(), name='generate_secret_view'),
|
||||
url(r'^generate_ns_secret/(?P<pk>\d+)/$', GenerateNSSecretView.as_view(), name='generate_ns_secret_view'),
|
||||
url(r'^host/add/$', AddHostView.as_view(), name='add_host'),
|
||||
url(r'^host/(?P<pk>\d+)/delete/$', DeleteHostView.as_view(), name='delete_host'),
|
||||
url(r'^domain_overview/$', DomainOverviewView.as_view(), name='domain_overview'),
|
||||
url(r'^domain/add/$', AddDomainView.as_view(), name='add_domain'),
|
||||
url(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'),
|
||||
url(r'^updater_hostconfig_overview/(?P<pk>\d+)/$', UpdaterHostConfigOverviewView.as_view(),
|
||||
name='updater_hostconfig_overview'),
|
||||
|
@ -41,7 +41,7 @@ class GenerateSecretView(UpdateView):
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(GenerateSecretView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_overview'] = True
|
||||
context['nav_host_overview'] = True
|
||||
# generate secret, store it hashed and return the plain secret for the context
|
||||
context['update_secret'] = self.object.generate_secret()
|
||||
context['hosts'] = Host.objects.filter(created_by=self.request.user)
|
||||
@ -173,20 +173,34 @@ class JsUpdateView(TemplateView):
|
||||
return context
|
||||
|
||||
|
||||
class OverviewView(CreateView):
|
||||
model = Host
|
||||
class OverviewView(TemplateView):
|
||||
template_name = "main/host_overview.html"
|
||||
form_class = CreateHostForm
|
||||
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(OverviewView, self).dispatch(*args, **kwargs)
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(OverviewView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_host_overview'] = True
|
||||
context['hosts'] = Host.objects.filter(created_by=self.request.user)
|
||||
return context
|
||||
|
||||
|
||||
class AddHostView(CreateView):
|
||||
template_name = "main/host_add.html"
|
||||
model = Host
|
||||
form_class = CreateHostForm
|
||||
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(AddHostView, self).dispatch(*args, **kwargs)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('generate_secret_view', args=(self.object.pk,))
|
||||
|
||||
def get_form(self, form_class):
|
||||
form = super(OverviewView, self).get_form(form_class)
|
||||
form = super(AddHostView, self).get_form(form_class)
|
||||
form.fields['domain'].queryset = Domain.objects.filter(
|
||||
Q(created_by=self.request.user) | Q(public=True))
|
||||
return form
|
||||
@ -217,9 +231,8 @@ class OverviewView(CreateView):
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(OverviewView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_overview'] = True
|
||||
context['hosts'] = Host.objects.filter(created_by=self.request.user)
|
||||
context = super(AddHostView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_host_overview'] = True
|
||||
return context
|
||||
|
||||
|
||||
@ -249,7 +262,7 @@ class HostView(UpdateView):
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(HostView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_overview'] = True
|
||||
context['nav_host_overview'] = True
|
||||
context['remote_addr'] = self.request.META['REMOTE_ADDR']
|
||||
context['hosts'] = Host.objects.filter(created_by=self.request.user)
|
||||
return context
|
||||
@ -274,20 +287,38 @@ class DeleteHostView(DeleteView):
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(DeleteHostView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_overview'] = True
|
||||
context['nav_host_overview'] = True
|
||||
context['hosts'] = Host.objects.filter(created_by=self.request.user)
|
||||
return context
|
||||
|
||||
|
||||
class DomainOverviewView(CreateView):
|
||||
model = Domain
|
||||
class DomainOverviewView(TemplateView):
|
||||
template_name = "main/domain_overview.html"
|
||||
form_class = CreateDomainForm
|
||||
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(DomainOverviewView, self).dispatch(*args, **kwargs)
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(
|
||||
DomainOverviewView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_domain_overview'] = True
|
||||
context['your_domains'] = Domain.objects.filter(
|
||||
created_by=self.request.user)
|
||||
context['public_domains'] = Domain.objects.filter(
|
||||
public=True).exclude(created_by=self.request.user)
|
||||
return context
|
||||
|
||||
|
||||
class AddDomainView(CreateView):
|
||||
template_name = "main/domain_add.html"
|
||||
model = Domain
|
||||
form_class = CreateDomainForm
|
||||
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(AddDomainView, self).dispatch(*args, **kwargs)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('generate_ns_secret_view', args=(self.object.pk,))
|
||||
|
||||
@ -300,7 +331,7 @@ class DomainOverviewView(CreateView):
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(
|
||||
DomainOverviewView, self).get_context_data(*args, **kwargs)
|
||||
AddDomainView, self).get_context_data(*args, **kwargs)
|
||||
context['nav_domain_overview'] = True
|
||||
context['your_domains'] = Domain.objects.filter(
|
||||
created_by=self.request.user)
|
||||
|
@ -40,7 +40,7 @@
|
||||
<a href="{% url 'home' %}"><i class="fa fa-home fa-fw"></i> {% trans "Home" %}</a>
|
||||
</li>
|
||||
{% if request.user.is_authenticated %}
|
||||
<li{% if nav_overview %} class="active"{% endif %}>
|
||||
<li{% if nav_host_overview %} class="active"{% endif %}>
|
||||
<a href="{% url 'overview' %}"><i class="fa fa-list fa-fw"></i> {% trans "Hosts" %}</a>
|
||||
</li>
|
||||
<li{% if nav_domain_overview %} class="active"{% endif %}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user