mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-25 16:33:47 +00:00
Support des enregistrements AAAA sur le @ de la zone
This commit is contained in:
parent
76e2226801
commit
7bd02c6c36
5 changed files with 40 additions and 5 deletions
|
@ -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):
|
||||
|
|
20
machines/migrations/0062_extension_origin_v6.py
Normal file
20
machines/migrations/0062_extension_origin_v6.py
Normal 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'),
|
||||
),
|
||||
]
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,6 +28,7 @@ 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>Enregistrement AAAA origin</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -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 %}
|
||||
|
|
Loading…
Reference in a new issue