mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Gère l'enregistrement origin A sur une zone
This commit is contained in:
parent
7097cad731
commit
145c64691c
5 changed files with 35 additions and 6 deletions
|
@ -14,7 +14,7 @@ class MachineTypeAdmin(VersionAdmin):
|
||||||
|
|
||||||
|
|
||||||
class ExtensionAdmin(VersionAdmin):
|
class ExtensionAdmin(VersionAdmin):
|
||||||
list_display = ('name',)
|
list_display = ('name','origin')
|
||||||
|
|
||||||
class MxAdmin(VersionAdmin):
|
class MxAdmin(VersionAdmin):
|
||||||
list_display = ('zone', 'priority', 'name')
|
list_display = ('zone', 'priority', 'name')
|
||||||
|
|
|
@ -112,17 +112,18 @@ class DelIpTypeForm(ModelForm):
|
||||||
class ExtensionForm(ModelForm):
|
class ExtensionForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = ['name']
|
fields = ['name', 'origin']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ExtensionForm, self).__init__(*args, **kwargs)
|
super(ExtensionForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['name'].label = 'Extension à ajouter'
|
self.fields['name'].label = 'Extension à ajouter'
|
||||||
|
self.fields['origin'].label = 'Enregistrement A origin'
|
||||||
|
|
||||||
class DelExtensionForm(ModelForm):
|
class DelExtensionForm(ModelForm):
|
||||||
extensions = forms.ModelMultipleChoiceField(queryset=Extension.objects.all(), label="Extensions actuelles", widget=forms.CheckboxSelectMultiple)
|
extensions = forms.ModelMultipleChoiceField(queryset=Extension.objects.all(), label="Extensions actuelles", widget=forms.CheckboxSelectMultiple)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
exclude = ['name']
|
exclude = ['name', 'origin']
|
||||||
model = Extension
|
model = Extension
|
||||||
|
|
||||||
class MxForm(ModelForm):
|
class MxForm(ModelForm):
|
||||||
|
|
25
machines/migrations/0032_auto_20161119_1850.py
Normal file
25
machines/migrations/0032_auto_20161119_1850.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('machines', '0031_auto_20161119_1709'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='extension',
|
||||||
|
name='origin',
|
||||||
|
field=models.OneToOneField(null=True, to='machines.IpList', blank=True, on_delete=django.db.models.deletion.PROTECT),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='extension',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(max_length=255, unique=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -43,7 +43,8 @@ class IpType(models.Model):
|
||||||
class Extension(models.Model):
|
class Extension(models.Model):
|
||||||
PRETTY_NAME = "Extensions dns"
|
PRETTY_NAME = "Extensions dns"
|
||||||
|
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255, unique=True)
|
||||||
|
origin = models.OneToOneField('IpList', on_delete=models.PROTECT, blank=True, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Extension</th>
|
<th>Extension</th>
|
||||||
<th></th>
|
<th>Enregistrement A origin</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for extension in extension_list %}
|
{% for extension in extension_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ extension.name }}</td>
|
<td>{{ extension.name }}</td>
|
||||||
<td class="text-right">
|
<td>{{ extension.origin }}</td>
|
||||||
|
<td class="text-right">
|
||||||
{% if is_infra %}
|
{% if is_infra %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue