8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00

Merge branch 'cleanup_machines' into 'dev'

Clean up of machines

See merge request federez/re2o!310
This commit is contained in:
klafyvel 2018-10-06 11:04:01 +02:00
commit ee2ee0ad12
41 changed files with 823 additions and 806 deletions

View file

@ -41,4 +41,3 @@ def can_view(user):
can = user.has_module_perms('machines') can = user.has_module_perms('machines')
return can, None if can else _("You don't have the right to view this" return can, None if can else _("You don't have the right to view this"
" application.") " application.")

View file

@ -29,7 +29,6 @@ from __future__ import unicode_literals
from django.contrib import admin from django.contrib import admin
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
from .models import ( from .models import (
Extension, Extension,
SOA, SOA,
@ -47,6 +46,7 @@ from .models import (
Ipv6List, Ipv6List,
OuverturePortList, OuverturePortList,
) )
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
class MachineAdmin(VersionAdmin): class MachineAdmin(VersionAdmin):
@ -98,6 +98,7 @@ class TxtAdmin(VersionAdmin):
""" Admin view of a TXT object """ """ Admin view of a TXT object """
pass pass
class DNameAdmin(VersionAdmin): class DNameAdmin(VersionAdmin):
""" Admin view of a DName object """ """ Admin view of a DName object """
pass pass
@ -147,12 +148,12 @@ class ServiceAdmin(VersionAdmin):
""" Admin view of a ServiceAdmin object """ """ Admin view of a ServiceAdmin object """
list_display = ('service_type', 'min_time_regen', 'regular_time_regen') list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
class RoleAdmin(VersionAdmin): class RoleAdmin(VersionAdmin):
""" Admin view of a RoleAdmin object """ """ Admin view of a RoleAdmin object """
pass pass
admin.site.register(Machine, MachineAdmin) admin.site.register(Machine, MachineAdmin)
admin.site.register(MachineType, MachineTypeAdmin) admin.site.register(MachineType, MachineTypeAdmin)
admin.site.register(IpType, IpTypeAdmin) admin.site.register(IpType, IpTypeAdmin)

View file

@ -35,13 +35,12 @@ Formulaires d'ajout, edition et suppressions de :
from __future__ import unicode_literals from __future__ import unicode_literals
from django.forms import ModelForm, Form
from django import forms from django import forms
from django.forms import ModelForm, Form
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from re2o.field_permissions import FieldPermissionFormMixin from re2o.field_permissions import FieldPermissionFormMixin
from re2o.mixins import FormRevMixin from re2o.mixins import FormRevMixin
from .models import ( from .models import (
Domain, Domain,
Machine, Machine,
@ -68,6 +67,7 @@ from .models import (
class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Formulaire d'édition d'une machine""" """Formulaire d'édition d'une machine"""
class Meta: class Meta:
model = Machine model = Machine
fields = '__all__' fields = '__all__'
@ -80,12 +80,14 @@ class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
class NewMachineForm(EditMachineForm): class NewMachineForm(EditMachineForm):
"""Creation d'une machine, ne renseigne que le nom""" """Creation d'une machine, ne renseigne que le nom"""
class Meta(EditMachineForm.Meta): class Meta(EditMachineForm.Meta):
fields = ['name'] fields = ['name']
class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Edition d'une interface. Edition complète""" """Edition d'une interface. Edition complète"""
class Meta: class Meta:
model = Interface model = Interface
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details'] fields = ['machine', 'type', 'ipv4', 'mac_address', 'details']
@ -128,12 +130,14 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
class AddInterfaceForm(EditInterfaceForm): class AddInterfaceForm(EditInterfaceForm):
"""Ajout d'une interface à une machine. En fonction des droits, """Ajout d'une interface à une machine. En fonction des droits,
affiche ou non l'ensemble des ip disponibles""" affiche ou non l'ensemble des ip disponibles"""
class Meta(EditInterfaceForm.Meta): class Meta(EditInterfaceForm.Meta):
fields = ['type', 'ipv4', 'mac_address', 'details'] fields = ['type', 'ipv4', 'mac_address', 'details']
class AliasForm(FormRevMixin, ModelForm): class AliasForm(FormRevMixin, ModelForm):
"""Ajout d'un alias (et edition), CNAME, contenant nom et extension""" """Ajout d'un alias (et edition), CNAME, contenant nom et extension"""
class Meta: class Meta:
model = Domain model = Domain
fields = ['name', 'extension'] fields = ['name', 'extension']
@ -151,6 +155,7 @@ class AliasForm(FormRevMixin, ModelForm):
class DomainForm(FormRevMixin, ModelForm): class DomainForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un enregistrement de nom, relié à interface""" """Ajout et edition d'un enregistrement de nom, relié à interface"""
class Meta: class Meta:
model = Domain model = Domain
fields = ['name'] fields = ['name']
@ -183,6 +188,7 @@ class DelAliasForm(FormRevMixin, Form):
class MachineTypeForm(FormRevMixin, ModelForm): class MachineTypeForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un machinetype, relié à un iptype""" """Ajout et edition d'un machinetype, relié à un iptype"""
class Meta: class Meta:
model = MachineType model = MachineType
fields = ['type', 'ip_type'] fields = ['type', 'ip_type']
@ -214,6 +220,7 @@ class DelMachineTypeForm(FormRevMixin, Form):
class IpTypeForm(FormRevMixin, ModelForm): class IpTypeForm(FormRevMixin, ModelForm):
"""Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de """Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de
stop après creation""" stop après creation"""
class Meta: class Meta:
model = IpType model = IpType
fields = '__all__' fields = '__all__'
@ -227,6 +234,7 @@ class IpTypeForm(FormRevMixin, ModelForm):
class EditIpTypeForm(IpTypeForm): class EditIpTypeForm(IpTypeForm):
"""Edition d'un iptype. Pas d'edition du rangev4 possible, car il faudrait """Edition d'un iptype. Pas d'edition du rangev4 possible, car il faudrait
synchroniser les objets iplist""" synchroniser les objets iplist"""
class Meta(IpTypeForm.Meta): class Meta(IpTypeForm.Meta):
fields = ['extension', 'type', 'need_infra', 'domaine_ip_network', 'domaine_ip_netmask', fields = ['extension', 'type', 'need_infra', 'domaine_ip_network', 'domaine_ip_netmask',
'prefix_v6', 'prefix_v6_length', 'prefix_v6', 'prefix_v6_length',
@ -253,6 +261,7 @@ class DelIpTypeForm(FormRevMixin, Form):
class ExtensionForm(FormRevMixin, ModelForm): class ExtensionForm(FormRevMixin, ModelForm):
"""Formulaire d'ajout et edition d'une extension""" """Formulaire d'ajout et edition d'une extension"""
class Meta: class Meta:
model = Extension model = Extension
fields = '__all__' fields = '__all__'
@ -285,6 +294,7 @@ class DelExtensionForm(FormRevMixin, Form):
class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Gestion des ipv6 d'une machine""" """Gestion des ipv6 d'une machine"""
class Meta: class Meta:
model = Ipv6List model = Ipv6List
fields = ['ipv6', 'slaac_ip'] fields = ['ipv6', 'slaac_ip']
@ -296,6 +306,7 @@ class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
class SOAForm(FormRevMixin, ModelForm): class SOAForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un SOA""" """Ajout et edition d'un SOA"""
class Meta: class Meta:
model = SOA model = SOA
fields = '__all__' fields = '__all__'
@ -324,6 +335,7 @@ class DelSOAForm(FormRevMixin, Form):
class MxForm(FormRevMixin, ModelForm): class MxForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un MX""" """Ajout et edition d'un MX"""
class Meta: class Meta:
model = Mx model = Mx
fields = ['zone', 'priority', 'name'] fields = ['zone', 'priority', 'name']
@ -357,6 +369,7 @@ class NsForm(FormRevMixin, ModelForm):
"""Ajout d'un NS pour une zone """Ajout d'un NS pour une zone
On exclue les CNAME dans les objets domain (interdit par la rfc) On exclue les CNAME dans les objets domain (interdit par la rfc)
donc on prend uniquemet """ donc on prend uniquemet """
class Meta: class Meta:
model = Ns model = Ns
fields = ['zone', 'ns'] fields = ['zone', 'ns']
@ -388,6 +401,7 @@ class DelNsForm(FormRevMixin, Form):
class TxtForm(FormRevMixin, ModelForm): class TxtForm(FormRevMixin, ModelForm):
"""Ajout d'un txt pour une zone""" """Ajout d'un txt pour une zone"""
class Meta: class Meta:
model = Txt model = Txt
fields = '__all__' fields = '__all__'
@ -416,6 +430,7 @@ class DelTxtForm(FormRevMixin, Form):
class DNameForm(FormRevMixin, ModelForm): class DNameForm(FormRevMixin, ModelForm):
"""Add a DNAME entry for a zone""" """Add a DNAME entry for a zone"""
class Meta: class Meta:
model = DName model = DName
fields = '__all__' fields = '__all__'
@ -444,6 +459,7 @@ class DelDNameForm(FormRevMixin, Form):
class SrvForm(FormRevMixin, ModelForm): class SrvForm(FormRevMixin, ModelForm):
"""Ajout d'un srv pour une zone""" """Ajout d'un srv pour une zone"""
class Meta: class Meta:
model = Srv model = Srv
fields = '__all__' fields = '__all__'
@ -473,6 +489,7 @@ class DelSrvForm(FormRevMixin, Form):
class NasForm(FormRevMixin, ModelForm): class NasForm(FormRevMixin, ModelForm):
"""Ajout d'un type de nas (machine d'authentification, """Ajout d'un type de nas (machine d'authentification,
swicths, bornes...)""" swicths, bornes...)"""
class Meta: class Meta:
model = Nas model = Nas
fields = '__all__' fields = '__all__'
@ -501,6 +518,7 @@ class DelNasForm(FormRevMixin, Form):
class RoleForm(FormRevMixin, ModelForm): class RoleForm(FormRevMixin, ModelForm):
"""Add and edit role.""" """Add and edit role."""
class Meta: class Meta:
model = Role model = Role
fields = '__all__' fields = '__all__'
@ -533,6 +551,7 @@ class DelRoleForm(FormRevMixin, Form):
class ServiceForm(FormRevMixin, ModelForm): class ServiceForm(FormRevMixin, ModelForm):
"""Ajout et edition d'une classe de service : dns, dhcp, etc""" """Ajout et edition d'une classe de service : dns, dhcp, etc"""
class Meta: class Meta:
model = Service model = Service
fields = '__all__' fields = '__all__'
@ -574,6 +593,7 @@ class DelServiceForm(FormRevMixin, Form):
class VlanForm(FormRevMixin, ModelForm): class VlanForm(FormRevMixin, ModelForm):
"""Ajout d'un vlan : id, nom""" """Ajout d'un vlan : id, nom"""
class Meta: class Meta:
model = Vlan model = Vlan
fields = ['vlan_id', 'name', 'comment'] fields = ['vlan_id', 'name', 'comment']
@ -614,6 +634,7 @@ class DelVlanForm(FormRevMixin, Form):
class EditOuverturePortConfigForm(FormRevMixin, ModelForm): class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
"""Edition de la liste des profils d'ouverture de ports """Edition de la liste des profils d'ouverture de ports
pour l'interface""" pour l'interface"""
class Meta: class Meta:
model = Interface model = Interface
fields = ['port_lists'] fields = ['port_lists']
@ -630,6 +651,7 @@ class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
class EditOuverturePortListForm(FormRevMixin, ModelForm): class EditOuverturePortListForm(FormRevMixin, ModelForm):
"""Edition de la liste des ports et profils d'ouverture """Edition de la liste des ports et profils d'ouverture
des ports""" des ports"""
class Meta: class Meta:
model = OuverturePortList model = OuverturePortList
fields = '__all__' fields = '__all__'
@ -645,6 +667,7 @@ class EditOuverturePortListForm(FormRevMixin, ModelForm):
class SshFpForm(FormRevMixin, ModelForm): class SshFpForm(FormRevMixin, ModelForm):
"""Edits a SSHFP record.""" """Edits a SSHFP record."""
class Meta: class Meta:
model = SshFp model = SshFp
exclude = ('machine',) exclude = ('machine',)
@ -656,4 +679,3 @@ class SshFpForm(FormRevMixin, ModelForm):
prefix=prefix, prefix=prefix,
**kwargs **kwargs
) )

View file

@ -27,32 +27,30 @@ The models definitions for the Machines app
from __future__ import unicode_literals from __future__ import unicode_literals
from datetime import timedelta import base64
import hashlib
import re import re
from datetime import timedelta
from ipaddress import IPv6Address from ipaddress import IPv6Address
from itertools import chain from itertools import chain
from netaddr import mac_bare, EUI, IPSet, IPRange, IPNetwork, IPAddress
import hashlib
import base64
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.db.models.signals import post_save, post_delete from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver from django.dispatch import receiver
from django.forms import ValidationError from django.forms import ValidationError
from django.utils.functional import cached_property
from django.utils import timezone from django.utils import timezone
from django.core.validators import MaxValueValidator, MinValueValidator from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from macaddress.fields import MACAddressField from macaddress.fields import MACAddressField
from netaddr import mac_bare, EUI, IPSet, IPRange, IPNetwork, IPAddress
import preferences.models
import users.models
from re2o.field_permissions import FieldPermissionModelMixin from re2o.field_permissions import FieldPermissionModelMixin
from re2o.mixins import AclMixin, RevMixin from re2o.mixins import AclMixin, RevMixin
import users.models
import preferences.models
class Machine(RevMixin, FieldPermissionModelMixin, models.Model): class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
""" Class définissant une machine, object parent user, objets fils """ Class définissant une machine, object parent user, objets fils
@ -333,7 +331,7 @@ class IpType(RevMixin, AclMixin, models.Model):
("use_all_iptype", _("Can use all IP types")), ("use_all_iptype", _("Can use all IP types")),
) )
verbose_name = _("IP type") verbose_name = _("IP type")
verbose_name_plural = ("IP types") verbose_name_plural = "IP types"
@cached_property @cached_property
def ip_range(self): def ip_range(self):
@ -973,7 +971,6 @@ class SshFp(RevMixin, AclMixin, models.Model):
return str(self.algo) + ' ' + str(self.comment) return str(self.algo) + ' ' + str(self.comment)
class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
""" Une interface. Objet clef de l'application machine : """ Une interface. Objet clef de l'application machine :
- une address mac unique. Possibilité de la rendre unique avec le - une address mac unique. Possibilité de la rendre unique avec le
@ -1877,7 +1874,6 @@ class OuverturePort(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
verbose_name = _("ports opening")
verbose_name = _("ports openings") verbose_name = _("ports openings")
def __str__(self): def __str__(self):
@ -2044,4 +2040,3 @@ def srv_post_save(**_kwargs):
def srv_post_delete(**_kwargs): def srv_post_delete(**_kwargs):
"""Regeneration dns après modification d'un SRV""" """Regeneration dns après modification d'un SRV"""
regen('dns') regen('dns')

View file

@ -26,8 +26,8 @@
Serializers for the Machines app Serializers for the Machines app
""" """
from rest_framework import serializers from rest_framework import serializers
from machines.models import ( from machines.models import (
Interface, Interface,
IpType, IpType,

View file

@ -45,4 +45,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -45,4 +45,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -60,4 +60,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</table> </table>
</div> </div>

View file

@ -48,7 +48,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ type.type }}</td> <td>{{ type.type }}</td>
<td>{{ type.extension }}</td> <td>{{ type.extension }}</td>
<td>{{ type.need_infra|tick }}</td> <td>{{ type.need_infra|tick }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </b></u>{{ type.ip_network }}{% endif %}</td> <td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </u></b>
{{ type.ip_network }}{% endif %}</td>
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td> <td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
<td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td> <td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td>
<td>{{ type.vlan }}</td> <td>{{ type.vlan }}</td>
@ -63,4 +64,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</table> </table>
</div> </div>

View file

@ -50,4 +50,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -73,7 +73,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td> <td>
{% if interface.domain.related_domain.all %} {% if interface.domain.related_domain.all %}
{{ interface.domain }} {{ interface.domain }}
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{ interface.id }}" aria-expanded="true" aria-controls="collapseDomain_{{ interface.id }}"> <button class="btn btn-default btn-xs" type="button" data-toggle="collapse"
data-target="#collapseDomain_{{ interface.id }}" aria-expanded="true"
aria-controls="collapseDomain_{{ interface.id }}">
{% trans "Display the aliases" %} {% trans "Display the aliases" %}
</button> </button>
{% else %} {% else %}
@ -91,7 +93,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<br> <br>
{% if ipv6_enabled and interface.ipv6 != 'None' %} {% if ipv6_enabled and interface.ipv6 != 'None' %}
<b>IPv6</b> <b>IPv6</b>
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{ interface.id }}" aria-expanded="true" aria-controls="collapseIpv6_{{ interface.id }}"> <button class="btn btn-default btn-xs" type="button" data-toggle="collapse"
data-target="#collapseIpv6_{{ interface.id }}" aria-expanded="true"
aria-controls="collapseIpv6_{{ interface.id }}">
{% trans "Display the IPv6 address" %} {% trans "Display the IPv6 address" %}
</button> </button>
{% endif %} {% endif %}
@ -99,7 +103,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td class="text-right"> <td class="text-right">
<div style="width: 128px;"> <div style="width: 128px;">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <button class="btn btn-primary btn-sm dropdown-toggle" type="button"
id="editioninterface" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
<i class="fa fa-edit"></i> <span class="caret"></span> <i class="fa fa-edit"></i> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="editioninterface"> <ul class="dropdown-menu" aria-labelledby="editioninterface">
@ -156,7 +162,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<td colspan=5 style="border-top: none; padding: 1px;"> <td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseIpv6_{{ interface.id }}"> <div class="collapse in" id="collapseIpv6_{{ interface.id }}">
<ul class="list-group" style="margin-bottom: 0px;"> <ul class="list-group" style="margin-bottom: 0;">
{% for ipv6 in interface.ipv6.all %} {% for ipv6 in interface.ipv6.all %}
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;"> <li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
{{ ipv6 }} {{ ipv6 }}
@ -171,7 +177,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<td colspan=5 style="border-top: none; padding: 1px;"> <td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseDomain_{{ interface.id }}"> <div class="collapse in" id="collapseDomain_{{ interface.id }}">
<ul class="list-group" style="margin-bottom: 0px;"> <ul class="list-group" style="margin-bottom: 0;">
{% for al in interface.domain.related_domain.all %} {% for al in interface.domain.related_domain.all %}
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;"> <li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
<a href="http://{{ al }}"> <a href="http://{{ al }}">
@ -191,7 +197,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</thead>
</table> </table>
<script> <script>
@ -213,4 +218,3 @@ $("#machines_table").ready( function() {
{% include "pagination.html" with list=machines_list %} {% include "pagination.html" with list=machines_list %}
{% endif %} {% endif %}
</div> </div>

View file

@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -49,4 +49,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -54,4 +54,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -51,4 +51,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -43,7 +43,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ service.min_time_regen }}</td> <td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td> <td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td> <td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fa fa-sync"></i></a></td> <td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i
class="fa fa-sync"></i></a></td>
<td class="text-right"> <td class="text-right">
{% can_edit service %} {% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %} {% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
@ -53,4 +54,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -55,4 +55,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -59,4 +59,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -52,4 +52,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</table> </table>
</div> </div>

View file

@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View file

@ -53,4 +53,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</table> </table>
</div> </div>

View file

@ -32,7 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}
<h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }} )?{% endblocktrans %}</h4> <h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }}
)?{% endblocktrans %}</h4>
{% trans "Confirm" as tr_confirm %} {% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %} {% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %}
</form> </form>
@ -40,4 +41,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -48,13 +48,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<p> <p>
{% trans "Add a port" as value %} {% trans "Add a port" as value %}
<input class="btn btn-primary btn-sm" role="button" value=value id="add_one"> <input class="btn btn-primary btn-sm" role="button" value="value" id="add_one">
</p> </p>
{% trans "Create or edit" as tr_create_or_edit %} {% trans "Create or edit" as tr_create_or_edit %}
{% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %} {% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %}
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
var template = `{{ports.empty_form}}`; var template = `{{ports.empty_form}}`;
function add_port() { function add_port() {
var new_index = document.getElementsByClassName('port').length; var new_index = document.getElementsByClassName('port').length;
document.getElementById('id_form-TOTAL_FORMS').value = document.getElementById('id_form-TOTAL_FORMS').value =
@ -64,9 +65,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
new_port.innerHTML = template.replace(/__prefix__/g, new_index); new_port.innerHTML = template.replace(/__prefix__/g, new_index);
document.getElementById('formset').appendChild(new_port); document.getElementById('formset').appendChild(new_port);
} }
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("add_one").addEventListener("click", add_port, true);});
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("add_one").addEventListener("click", add_port, true);
});
</script> </script>
{% endblock %} {% endblock %}

View file

@ -35,4 +35,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -30,11 +30,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of the aliases of the interface" %}</h2> <h2>{% trans "List of the aliases of the interface" %}</h2>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-alias' interface_id %}"><i class="fa fa-plus"></i>{% trans " Add an alias" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-alias' interface_id %}"><i
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-alias' interface_id %}"><i class="fa fa-trash"></i>{% trans " Delete one or several aliases" %}</a> class="fa fa-plus"></i>{% trans " Add an alias" %}</a>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-alias' interface_id %}"><i
class="fa fa-trash"></i>{% trans " Delete one or several aliases" %}</a>
{% include "machines/aff_alias.html" with alias_list=alias_list %} {% include "machines/aff_alias.html" with alias_list=alias_list %}
<br/> <br/>
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
@ -33,37 +32,57 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of extensions" %}</h2> <h2>{% trans "List of extensions" %}</h2>
{% can_create Extension %} {% can_create Extension %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-extension' %}"><i class="fa fa-plus"></i>{% trans " Add an extension" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-extension' %}">
<i class="fa fa-plus"></i>
{% trans " Add an extension" %}</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-extension' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several extensions" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-extension' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several extensions" %}
</a>
{% include "machines/aff_extension.html" with extension_list=extension_list %} {% include "machines/aff_extension.html" with extension_list=extension_list %}
<h2>{% trans "List of SOA records" %}</h2> <h2>{% trans "List of SOA records" %}</h2>
{% can_create SOA %} {% can_create SOA %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-soa' %}"><i class="fa fa-plus"></i>{% trans " Add an SOA record" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-soa' %}">
<i class="fa fa-plus"></i>{% trans " Add an SOA record" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-soa' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several SOA records" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-soa' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several SOA records" %}
</a>
{% include "machines/aff_soa.html" with soa_list=soa_list %} {% include "machines/aff_soa.html" with soa_list=soa_list %}
<h2>{% trans "List of MX records" %}</h2> <h2>{% trans "List of MX records" %}</h2>
{% can_create Mx %} {% can_create Mx %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-mx' %}"><i class="fa fa-plus"></i>{% trans " Add an MX record" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-mx' %}">
<i class="fa fa-plus"></i>{% trans " Add an MX record" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-mx' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several MX records" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-mx' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several MX records" %}
</a>
{% include "machines/aff_mx.html" with mx_list=mx_list %} {% include "machines/aff_mx.html" with mx_list=mx_list %}
<h2>{% trans "List of NS records" %}</h2> <h2>{% trans "List of NS records" %}</h2>
{% can_create Ns %} {% can_create Ns %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-ns' %}"><i class="fa fa-plus"></i>{% trans " Add an NS record" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-ns' %}">
<i class="fa fa-plus"></i>{% trans " Add an NS record" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-ns' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several NS records" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-ns' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several NS records" %}
</a>
{% include "machines/aff_ns.html" with ns_list=ns_list %} {% include "machines/aff_ns.html" with ns_list=ns_list %}
<h2>{% trans "List of TXT records" %}</h2> <h2>{% trans "List of TXT records" %}</h2>
{% can_create Txt %} {% can_create Txt %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-txt' %}"><i class="fa fa-plus"></i>{% trans " Add a TXT record" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-txt' %}">
<i class="fa fa-plus"></i>{% trans " Add a TXT record" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-txt' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several TXT records" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-txt' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several TXT records" %}
</a>
{% include "machines/aff_txt.html" with txt_list=txt_list %} {% include "machines/aff_txt.html" with txt_list=txt_list %}
<h2>{% trans "List of DNAME records" %}</h2> <h2>{% trans "List of DNAME records" %}</h2>
@ -79,12 +98,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of SRV records" %}</h2> <h2>{% trans "List of SRV records" %}</h2>
{% can_create Srv %} {% can_create Srv %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-srv' %}"><i class="fa fa-plus"></i>{% trans " Add an SRV record" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-srv' %}">
<i class="fa fa-plus"></i>{% trans " Add an SRV record" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-srv' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several SRV records" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-srv' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several SRV records" %}
</a>
{% include "machines/aff_srv.html" with srv_list=srv_list %} {% include "machines/aff_srv.html" with srv_list=srv_list %}
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
@ -33,12 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of IP types" %}</h2> <h2>{% trans "List of IP types" %}</h2>
{% can_create IpType %} {% can_create IpType %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-iptype' %}"><i class="fa fa-plus"></i>{% trans " Add an IP type" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-iptype' %}">
<i class="fa fa-plus"></i>{% trans " Add an IP type" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-iptype' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several IP types" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-iptype' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several IP types" %}
</a>
{% include "machines/aff_iptype.html" with iptype_list=iptype_list %} {% include "machines/aff_iptype.html" with iptype_list=iptype_list %}
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -32,11 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of the IPv6 addresses of the interface" %}</h2> <h2>{% trans "List of the IPv6 addresses of the interface" %}</h2>
{% can_create Ipv6List interface_id %} {% can_create Ipv6List interface_id %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-ipv6list' interface_id %}"><i class="fa fa-plus"></i>{% trans " Add an IPv6 address" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-ipv6list' interface_id %}">
<i class="fa fa-plus"></i>{% trans " Add an IPv6 address" %}
</a>
{% acl_end %} {% acl_end %}
{% include "machines/aff_ipv6.html" with ipv6_list=ipv6_list %} {% include "machines/aff_ipv6.html" with ipv6_list=ipv6_list %}
<br/> <br/>
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -33,12 +33,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of machine types" %}</h2> <h2>{% trans "List of machine types" %}</h2>
{% can_create MachineType %} {% can_create MachineType %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-machinetype' %}"><i class="fa fa-plus"></i>{% trans " Add a machine type" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-machinetype' %}">
<i class="fa fa-plus"></i>{% trans " Add a machine type" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-machinetype' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several machine types" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-machinetype' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several machine types" %}
</a>
{% include "machines/aff_machinetype.html" with machinetype_list=machinetype_list %} {% include "machines/aff_machinetype.html" with machinetype_list=machinetype_list %}
<br/> <br/>
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -34,12 +34,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of NAS devices" %}</h2> <h2>{% trans "List of NAS devices" %}</h2>
<h5>{% trans "The NAS device type and machine type are linked. It is useful for MAC address auto capture by RADIUS, and allows to choose the machine type to assign to the machines according to the NAS device type." %}</h5> <h5>{% trans "The NAS device type and machine type are linked. It is useful for MAC address auto capture by RADIUS, and allows to choose the machine type to assign to the machines according to the NAS device type." %}</h5>
{% can_create Nas %} {% can_create Nas %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-nas' %}"><i class="fa fa-plus"></i>{% trans " Add a NAS device type" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-nas' %}">
<i class="fa fa-plus"></i>{% trans " Add a NAS device type" %}
</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-nas' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several NAS device types" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-nas' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several NAS device types" %}
</a>
{% include "machines/aff_nas.html" with nas_list=nas_list %} {% include "machines/aff_nas.html" with nas_list=nas_list %}
<br/> <br/>
<br/> <br/>
<br/> <br/>
{% endblock %} {% endblock %}

View file

@ -10,7 +10,9 @@
{% block content %} {% block content %}
<h2>{% trans "List of ports configurations" %}</h2> <h2>{% trans "List of ports configurations" %}</h2>
{% can_create OuverturePortList %} {% can_create OuverturePortList %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-portlist' %}"><i class="fa fa-plus"></i>{% trans " Add a configuration" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-portlist' %}">
<i class="fa fa-plus"></i>{% trans " Add a configuration" %}
</a>
{% acl_end %} {% acl_end %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -34,7 +36,8 @@
<td> <td>
{% if pl.interface_set.all %} {% if pl.interface_set.all %}
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <button class="btn btn-default dropdown-toggle" type="button" id="editioninterface"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="editioninterface"> <ul class="dropdown-menu" aria-labelledby="editioninterface">
@ -59,9 +62,4 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -32,11 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of roles" %}</h2> <h2>{% trans "List of roles" %}</h2>
{% can_create Role %} {% can_create Role %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-role' %}"><i class="fa fa-plus"></i>{% trans " Add a role"%}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-role' %}"><i
class="fa fa-plus"></i>{% trans " Add a role" %}</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-role' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several roles" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-role' %}"><i
class="fa fa-trash"></i>{% trans " Delete one or several roles" %}</a>
{% include "machines/aff_role.html" with role_list=role_list %} {% include "machines/aff_role.html" with role_list=role_list %}
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -32,14 +32,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of services" %}</h2> <h2>{% trans "List of services" %}</h2>
{% can_create machines.Service %} {% can_create machines.Service %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-service' %}"><i class="fa fa-plus"></i>{% trans " Add a service" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-service' %}"><i
class="fa fa-plus"></i>{% trans " Add a service" %}</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-service' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several services" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-service' %}"><i
class="fa fa-trash"></i>{% trans " Delete one or several services" %}</a>
{% include "machines/aff_service.html" with service_list=service_list %} {% include "machines/aff_service.html" with service_list=service_list %}
<h2>{% trans "States of servers" %}</h2> <h2>{% trans "States of servers" %}</h2>
{% include "machines/aff_servers.html" with servers_list=servers_list %} {% include "machines/aff_servers.html" with servers_list=servers_list %}
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -36,4 +36,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %} {% acl_end %}
{% include "machines/aff_sshfp.html" with sshfp_list=sshfp_list %} {% include "machines/aff_sshfp.html" with sshfp_list=sshfp_list %}
{% endblock %} {% endblock %}

View file

@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
@ -33,12 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "List of VLANs" %}</h2> <h2>{% trans "List of VLANs" %}</h2>
{% can_create Vlan %} {% can_create Vlan %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-vlan' %}"><i class="fa fa-plus"></i>{% trans " Add a VLAN" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-vlan' %}"><i
class="fa fa-plus"></i>{% trans " Add a VLAN" %}</a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-vlan' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several VLANs" %}</a> <a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-vlan' %}"><i
class="fa fa-trash"></i>{% trans " Delete one or several VLANs" %}</a>
{% include "machines/aff_vlan.html" with vlan_list=vlan_list %} {% include "machines/aff_vlan.html" with vlan_list=vlan_list %}
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -170,8 +170,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %} {% endif %}
{% bootstrap_button action_name button_type="submit" icon='ok' button_class='btn-success' %} {% bootstrap_button action_name button_type="submit" icon='ok' button_class='btn-success' %}
</form> </form>
<br />
<br />
<br />
{% endblock %} {% endblock %}

View file

@ -82,4 +82,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a> </a>
{% acl_end %} {% acl_end %}
{% endblock %} {% endblock %}

View file

@ -27,6 +27,7 @@ The defined URLs for the Machines app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
urlpatterns = [ urlpatterns = [

View file

@ -32,26 +32,18 @@ The views for the Machines app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
from django.db.models import ProtectedError, F from django.db.models import ProtectedError, F
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.urls import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer from rest_framework.renderers import JSONRenderer
from users.models import User
from preferences.models import GeneralOption from preferences.models import GeneralOption
from re2o.utils import (
all_active_assigned_interfaces,
filter_active_interfaces,
SortTable,
re2o_paginator,
)
from re2o.acl import ( from re2o.acl import (
can_create, can_create,
can_edit, can_edit,
@ -60,21 +52,14 @@ from re2o.acl import (
can_view_all, can_view_all,
can_delete_set, can_delete_set,
) )
from re2o.views import form from re2o.utils import (
all_active_assigned_interfaces,
from .serializers import ( filter_active_interfaces,
FullInterfaceSerializer, SortTable,
InterfaceSerializer, re2o_paginator,
TypeSerializer,
DomainSerializer,
TxtSerializer,
SrvSerializer,
MxSerializer,
ExtensionSerializer,
ServiceServersSerializer,
NsSerializer,
) )
from re2o.views import form
from users.models import User
from .forms import ( from .forms import (
NewMachineForm, NewMachineForm,
EditMachineForm, EditMachineForm,
@ -139,6 +124,18 @@ from .models import (
OuverturePort, OuverturePort,
Ipv6List, Ipv6List,
) )
from .serializers import (
FullInterfaceSerializer,
InterfaceSerializer,
TypeSerializer,
DomainSerializer,
TxtSerializer,
SrvSerializer,
MxSerializer,
ExtensionSerializer,
ServiceServersSerializer,
NsSerializer,
)
def f_type_id(is_type_tt): def f_type_id(is_type_tt):
@ -889,6 +886,7 @@ def del_ns(request, instances):
request request
) )
@login_required @login_required
@can_create(DName) @can_create(DName)
def add_dname(request): def add_dname(request):
@ -1252,6 +1250,7 @@ def del_service(request, instances):
request request
) )
@login_required @login_required
@can_edit(Service) @can_edit(Service)
def regen_service(request, service, **_kwargs): def regen_service(request, service, **_kwargs):
@ -1261,7 +1260,6 @@ def regen_service(request,service, **_kwargs):
return index_service(request) return index_service(request)
@login_required @login_required
@can_create(Vlan) @can_create(Vlan)
def add_vlan(request): def add_vlan(request):
@ -1939,4 +1937,3 @@ def regen_achieved(request):
if obj: if obj:
obj.first().done_regen() obj.first().done_regen()
return HttpResponse("Ok") return HttpResponse("Ok")