8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Support des enregistrements AAAA sur le @ de la zone

This commit is contained in:
chirac 2017-10-18 16:27:48 +02:00
parent 37870265f4
commit 4143558604
5 changed files with 40 additions and 5 deletions

View file

@ -266,13 +266,14 @@ class ExtensionForm(ModelForm):
"""Formulaire d'ajout et edition d'une extension"""
class Meta:
model = Extension
fields = ['name', 'need_infra', 'origin']
fields = '__all__'
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['name'].label = 'Extension à ajouter'
self.fields['origin'].label = 'Enregistrement A origin'
self.fields['origin_v6'].label = 'Enregistrement AAAA origin'
class DelExtensionForm(Form):

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-10-18 14:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('machines', '0061_auto_20171015_2033'),
]
operations = [
migrations.AddField(
model_name='extension',
name='origin_v6',
field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'),
),
]

View file

@ -247,11 +247,23 @@ class Extension(models.Model):
blank=True,
null=True
)
origin_v6 = models.GenericIPAddressField(
protocol='IPv6',
null=True,
blank=True
)
@cached_property
def dns_entry(self):
""" Une entrée DNS A"""
return "@ IN A " + str(self.origin)
""" Une entrée DNS A et AAAA sur origin (zone self)"""
entry = ""
if self.origin:
entry += "@ IN A " + str(self.origin)
if self.origin_v6:
if entry:
entry += "\n"
entry += "@ IN AAAA " + str(self.origin_v6)
return entry
def __str__(self):
return self.name

View file

@ -161,7 +161,7 @@ class ExtensionSerializer(serializers.ModelSerializer):
class Meta:
model = Extension
fields = ('name', 'origin', 'zone_entry')
fields = ('name', 'origin', 'origin_v6', 'zone_entry')
def get_origin_ip(self, obj):
return obj.origin.ipv4

View file

@ -28,7 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Extension</th>
<th>Autorisation infra pour utiliser l'extension</th>
<th>Enregistrement A origin</th>
<th></th>
<th>Enregistrement AAAA origin</th>
<th></th>
</tr>
</thead>
{% for extension in extension_list %}
@ -36,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra }}</td>
<td>{{ extension.origin }}</td>
<td>{{ extension.origin_v6 }}</td>
<td class="text-right">
{% if is_infra %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}