diff --git a/machines/forms.py b/machines/forms.py
index 6b3d905e..d54427e1 100644
--- a/machines/forms.py
+++ b/machines/forms.py
@@ -137,3 +137,14 @@ class DelMxForm(ModelForm):
exclude = ['zone', 'priority', 'name']
model = Mx
+class NsForm(ModelForm):
+ class Meta:
+ model = Ns
+ fields = ['zone', 'interface']
+
+class DelNsForm(ModelForm):
+ ns = forms.ModelMultipleChoiceField(queryset=Ns.objects.all(), label="Enregistrements NS actuels", widget=forms.CheckboxSelectMultiple)
+
+ class Meta:
+ exclude = ['zone', 'interface']
+ model = Ns
diff --git a/machines/models.py b/machines/models.py
index bf1eca2e..0ff636c2 100644
--- a/machines/models.py
+++ b/machines/models.py
@@ -64,6 +64,9 @@ class Ns(models.Model):
zone = models.ForeignKey('Extension', on_delete=models.PROTECT)
interface = models.OneToOneField('Interface', on_delete=models.PROTECT)
+ def __str__(self):
+ return str(self.zone) + ' ' + str(self.interface)
+
class Interface(models.Model):
PRETTY_NAME = "Interface"
diff --git a/machines/templates/machines/aff_ns.html b/machines/templates/machines/aff_ns.html
new file mode 100644
index 00000000..56ba3b3e
--- /dev/null
+++ b/machines/templates/machines/aff_ns.html
@@ -0,0 +1,24 @@
+
+
+
+ Zone concernée |
+ Interface autoritaire de la zone |
+ |
+ |
+
+
+ {% for ns in ns_list %}
+
+ {{ ns.zone }} |
+ {{ ns.interface }} |
+
+ {% if is_infra %}
+ {% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
+ {% endif %}
+ {% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %}
+ |
+
+ {% endfor %}
+
+
+
diff --git a/machines/templates/machines/index_extension.html b/machines/templates/machines/index_extension.html
index d058f805..f47b05d6 100644
--- a/machines/templates/machines/index_extension.html
+++ b/machines/templates/machines/index_extension.html
@@ -17,7 +17,13 @@
Supprimer un enregistrement MX
{% endif %}
{% include "machines/aff_mx.html" with mx_list=mx_list %}
-
+ Liste des enregistrements NS
+ {% if is_infra %}
+ Ajouter un enregistrement NS
+ Supprimer un enregistrement NS
+ {% endif %}
+ {% include "machines/aff_ns.html" with ns_list=ns_list %}
+
{% endblock %}
diff --git a/machines/urls.py b/machines/urls.py
index e3f47578..b93c0373 100644
--- a/machines/urls.py
+++ b/machines/urls.py
@@ -23,12 +23,16 @@ urlpatterns = [
url(r'^add_mx/$', views.add_mx, name='add-mx'),
url(r'^edit_mx/(?P[0-9]+)$', views.edit_mx, name='edit-mx'),
url(r'^del_mx/$', views.del_mx, name='del-mx'),
+ url(r'^add_ns/$', views.add_ns, name='add-ns'),
+ url(r'^edit_ns/(?P[0-9]+)$', views.edit_ns, name='edit-ns'),
+ url(r'^del_ns/$', views.del_ns, name='del-ns'),
url(r'^index_extension/$', views.index_extension, name='index-extension'),
url(r'^history/(?P