Commit 34bf50e7 authored by Laouen Fernet's avatar Laouen Fernet

Translation of machines/ (front)

parent af40e3ea
......@@ -25,6 +25,7 @@
Here are defined some functions to check acl on the application.
"""
from django.utils.translation import ugettext as _
def can_view(user):
......@@ -38,4 +39,6 @@ def can_view(user):
viewing is granted and msg is a message (can be None).
"""
can = user.has_module_perms('machines')
return can, None if can else "Vous ne pouvez pas voir cette application."
return can, None if can else _("You don't have the right to view this"
" application.")
......@@ -37,7 +37,7 @@ from __future__ import unicode_literals
from django.forms import ModelForm, Form
from django import forms
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from re2o.field_permissions import FieldPermissionFormMixin
from re2o.mixins import FormRevMixin
......@@ -75,7 +75,7 @@ class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(EditMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['name'].label = 'Nom de la machine'
self.fields['name'].label = _("Machine name")
class NewMachineForm(EditMachineForm):
......@@ -94,12 +94,11 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
user = kwargs.get('user')
super(EditInterfaceForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['mac_address'].label = 'Adresse mac'
self.fields['type'].label = 'Type de machine'
self.fields['type'].empty_label = "Séléctionner un type de machine"
self.fields['mac_address'].label = _("MAC address")
self.fields['type'].label = _("Machine type")
self.fields['type'].empty_label = _("Select a machine type")
if "ipv4" in self.fields:
self.fields['ipv4'].empty_label = ("Assignation automatique de "
"l'ipv4")
self.fields['ipv4'].empty_label = _("Automatic IPv4 assignment")
self.fields['ipv4'].queryset = IpList.objects.filter(
interface__isnull=True
)
......@@ -170,7 +169,7 @@ class DelAliasForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs objets alias"""
alias = forms.ModelMultipleChoiceField(
queryset=Domain.objects.all(),
label="Alias actuels",
label=_("Current aliases"),
widget=forms.CheckboxSelectMultiple
)
......@@ -191,15 +190,15 @@ class MachineTypeForm(FormRevMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MachineTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['type'].label = 'Type de machine à ajouter'
self.fields['ip_type'].label = "Type d'ip relié"
self.fields['type'].label = _("Machine type to add")
self.fields['ip_type'].label = _("Related IP type")
class DelMachineTypeForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs machinetype"""
machinetypes = forms.ModelMultipleChoiceField(
queryset=MachineType.objects.none(),
label="Types de machines actuelles",
label=_("Current machine types"),
widget=forms.CheckboxSelectMultiple
)
......@@ -222,7 +221,7 @@ class IpTypeForm(FormRevMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(IpTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['type'].label = 'Type ip à ajouter'
self.fields['type'].label = _("IP type to add")
class EditIpTypeForm(IpTypeForm):
......@@ -239,7 +238,7 @@ class DelIpTypeForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs iptype"""
iptypes = forms.ModelMultipleChoiceField(
queryset=IpType.objects.none(),
label="Types d'ip actuelles",
label=_("Current IP types"),
widget=forms.CheckboxSelectMultiple
)
......@@ -261,17 +260,17 @@ class ExtensionForm(FormRevMixin, ModelForm):
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'
self.fields['soa'].label = 'En-tête SOA à utiliser'
self.fields['name'].label = _("Extension to add")
self.fields['origin'].label = _("A record origin")
self.fields['origin_v6'].label = _("AAAA record origin")
self.fields['soa'].label = _("SOA record to use")
class DelExtensionForm(FormRevMixin, Form):
"""Suppression d'une ou plusieurs extensions"""
extensions = forms.ModelMultipleChoiceField(
queryset=Extension.objects.none(),
label="Extensions actuelles",
label=_("Current extensions"),
widget=forms.CheckboxSelectMultiple
)
......@@ -310,7 +309,7 @@ class DelSOAForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs SOA"""
soa = forms.ModelMultipleChoiceField(
queryset=SOA.objects.none(),
label="SOA actuels",
label=_("Current SOA records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -341,7 +340,7 @@ class DelMxForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs MX"""
mx = forms.ModelMultipleChoiceField(
queryset=Mx.objects.none(),
label="MX actuels",
label=_("Current MX records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -374,7 +373,7 @@ class DelNsForm(FormRevMixin, Form):
"""Suppresion d'un ou plusieurs NS"""
ns = forms.ModelMultipleChoiceField(
queryset=Ns.objects.none(),
label="Enregistrements NS actuels",
label=_("Current NS records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -402,7 +401,7 @@ class DelTxtForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs TXT"""
txt = forms.ModelMultipleChoiceField(
queryset=Txt.objects.none(),
label="Enregistrements Txt actuels",
label=_("Current TXT records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -430,7 +429,7 @@ class DelDNameForm(FormRevMixin, Form):
"""Delete a set of DNAME entries"""
dnames = forms.ModelMultipleChoiceField(
queryset=Txt.objects.none(),
label="Existing DNAME entries",
label=_("Current DNAME records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -458,7 +457,7 @@ class DelSrvForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs Srv"""
srv = forms.ModelMultipleChoiceField(
queryset=Srv.objects.none(),
label="Enregistrements Srv actuels",
label=_("Current SRV records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -487,7 +486,7 @@ class DelNasForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs nas"""
nas = forms.ModelMultipleChoiceField(
queryset=Nas.objects.none(),
label="Enregistrements Nas actuels",
label=_("Current NAS devices"),
widget=forms.CheckboxSelectMultiple
)
......@@ -519,7 +518,7 @@ class DelRoleForm(FormRevMixin, Form):
"""Deletion of one or several roles."""
role = forms.ModelMultipleChoiceField(
queryset=Role.objects.none(),
label=_l("Current roles"),
label=_("Current roles"),
widget=forms.CheckboxSelectMultiple
)
......@@ -560,7 +559,7 @@ class DelServiceForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs service"""
service = forms.ModelMultipleChoiceField(
queryset=Service.objects.none(),
label="Services actuels",
label=_("Current services"),
widget=forms.CheckboxSelectMultiple
)
......@@ -588,7 +587,7 @@ class DelVlanForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs vlans"""
vlan = forms.ModelMultipleChoiceField(
queryset=Vlan.objects.none(),
label="Vlan actuels",
label=_("Current VLANs"),
widget=forms.CheckboxSelectMultiple
)
......@@ -646,3 +645,4 @@ class SshFpForm(FormRevMixin, ModelForm):
prefix=prefix,
**kwargs
)
This diff is collapsed.
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-15 17:18
from __future__ import unicode_literals
import datetime
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('machines', '0093_auto_20180807_1115'),
]
operations = [
migrations.AlterModelOptions(
name='dname',
options={'permissions': (('view_dname', 'Can view a DNAME record object'),), 'verbose_name': 'DNAME record', 'verbose_name_plural': 'DNAME records'},
),
migrations.AlterModelOptions(
name='domain',
options={'permissions': (('view_domain', 'Can view a domain object'),), 'verbose_name': 'domain', 'verbose_name_plural': 'domains'},
),
migrations.AlterModelOptions(
name='extension',
options={'permissions': (('view_extension', 'Can view an extension object'), ('use_all_extension', 'Can use all extensions')), 'verbose_name': 'DNS extension', 'verbose_name_plural': 'DNS extensions'},
),
migrations.AlterModelOptions(
name='interface',
options={'permissions': (('view_interface', 'Can view an interface object'), ('change_interface_machine', 'Can change the owner of an interface')), 'verbose_name': 'interface', 'verbose_name_plural': 'interfaces'},
),
migrations.AlterModelOptions(
name='iplist',
options={'permissions': (('view_iplist', 'Can view an IPv4 addresses list object'),), 'verbose_name': 'IPv4 addresses list', 'verbose_name_plural': 'IPv4 addresses lists'},
),
migrations.AlterModelOptions(
name='iptype',
options={'permissions': (('view_iptype', 'Can view an IP type object'), ('use_all_iptype', 'Can use all IP types')), 'verbose_name': 'IP type', 'verbose_name_plural': 'IP types'},
),
migrations.AlterModelOptions(
name='ipv6list',
options={'permissions': (('view_ipv6list', 'Can view an IPv6 addresses list object'), ('change_ipv6list_slaac_ip', 'Can change the SLAAC value of an IPv6 addresses list')), 'verbose_name': 'IPv6 addresses list', 'verbose_name_plural': 'IPv6 addresses lists'},
),
migrations.AlterModelOptions(
name='machine',
options={'permissions': (('view_machine', 'Can view a machine object'), ('change_machine_user', 'Can change the user of a machine')), 'verbose_name': 'machine', 'verbose_name_plural': 'machines'},
),
migrations.AlterModelOptions(
name='machinetype',
options={'permissions': (('view_machinetype', 'Can view a machine type object'), ('use_all_machinetype', 'Can use all machine types')), 'verbose_name': 'machine type', 'verbose_name_plural': 'machine types'},
),
migrations.AlterModelOptions(
name='mx',
options={'permissions': (('view_mx', 'Can view an MX record object'),), 'verbose_name': 'MX record', 'verbose_name_plural': 'MX records'},
),
migrations.AlterModelOptions(
name='nas',
options={'permissions': (('view_nas', 'Can view a NAS device object'),), 'verbose_name': 'NAS device', 'verbose_name_plural': 'NAS devices'},
),
migrations.AlterModelOptions(
name='ns',
options={'permissions': (('view_ns', 'Can view an NS record object'),), 'verbose_name': 'NS record', 'verbose_name_plural': 'NS records'},
),
migrations.AlterModelOptions(
name='ouvertureport',
options={'verbose_name': 'ports openings'},
),
migrations.AlterModelOptions(
name='ouvertureportlist',
options={'permissions': (('view_ouvertureportlist', 'Can view a ports opening list object'),), 'verbose_name': 'ports opening list', 'verbose_name_plural': 'ports opening lists'},
),
migrations.AlterModelOptions(
name='role',
options={'permissions': (('view_role', 'Can view a role object'),), 'verbose_name': 'server role', 'verbose_name_plural': 'server roles'},
),
migrations.AlterModelOptions(
name='service',
options={'permissions': (('view_service', 'Can view a service object'),), 'verbose_name': 'service to generate (DHCP, DNS, ...)', 'verbose_name_plural': 'services to generate (DHCP, DNS, ...)'},
),
migrations.AlterModelOptions(
name='service_link',
options={'permissions': (('view_service_link', 'Can view a service server link object'),), 'verbose_name': 'link between service and server', 'verbose_name_plural': 'links between service and server'},
),
migrations.AlterModelOptions(
name='soa',
options={'permissions': (('view_soa', 'Can view an SOA record object'),), 'verbose_name': 'SOA record', 'verbose_name_plural': 'SOA records'},
),
migrations.AlterModelOptions(
name='srv',
options={'permissions': (('view_srv', 'Can view an SRV record object'),), 'verbose_name': 'SRV record', 'verbose_name_plural': 'SRV records'},
),
migrations.AlterModelOptions(
name='sshfp',
options={'permissions': (('view_sshfp', 'Can view an SSHFP record object'),), 'verbose_name': 'SSHFP record', 'verbose_name_plural': 'SSHFP records'},
),
migrations.AlterModelOptions(
name='txt',
options={'permissions': (('view_txt', 'Can view a TXT record object'),), 'verbose_name': 'TXT record', 'verbose_name_plural': 'TXT records'},
),
migrations.AlterModelOptions(
name='vlan',
options={'permissions': (('view_vlan', 'Can view a VLAN object'),), 'verbose_name': 'VLAN', 'verbose_name_plural': 'VLANs'},
),
migrations.AlterField(
model_name='domain',
name='name',
field=models.CharField(help_text='Mandatory and unique, must not contain dots.', max_length=255),
),
migrations.AlterField(
model_name='extension',
name='name',
field=models.CharField(help_text='Zone name, must begin with a dot (.example.org)', max_length=255, unique=True),
),
migrations.AlterField(
model_name='extension',
name='origin',
field=models.ForeignKey(blank=True, help_text='A record associated with the zone', null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'),
),
migrations.AlterField(
model_name='extension',
name='origin_v6',
field=models.GenericIPAddressField(blank=True, help_text='AAAA record associated with the zone', null=True, protocol='IPv6'),
),
migrations.AlterField(
model_name='iptype',
name='domaine_ip_netmask',
field=models.IntegerField(default=24, help_text="Netmask for the domain's IPv4 range", validators=[django.core.validators.MaxValueValidator(31), django.core.validators.MinValueValidator(8)]),
),
migrations.AlterField(
model_name='iptype',
name='domaine_ip_network',
field=models.GenericIPAddressField(blank=True, help_text="Network containing the domain's IPv4 range (optional)", null=True, protocol='IPv4'),
),
migrations.AlterField(
model_name='iptype',
name='reverse_v4',
field=models.BooleanField(default=False, help_text='Enable reverse DNS for IPv4'),
),
migrations.AlterField(
model_name='iptype',
name='reverse_v6',
field=models.BooleanField(default=False, help_text='Enable reverse DNS for IPv6'),
),
migrations.AlterField(
model_name='machine',
name='name',
field=models.CharField(blank=True, help_text='Optional', max_length=255, null=True),
),
migrations.AlterField(
model_name='ouvertureportlist',
name='name',
field=models.CharField(help_text='Name of the ports configuration', max_length=255),
),
migrations.AlterField(
model_name='role',
name='specific_role',
field=models.CharField(blank=True, choices=[('dhcp-server', 'DHCP server'), ('switch-conf-server', 'Switches configuration server'), ('dns-recursif-server', 'Recursive DNS server'), ('ntp-server', 'NTP server'), ('radius-server', 'RADIUS server'), ('log-server', 'Log server'), ('ldap-master-server', 'LDAP master server'), ('ldap-backup-server', 'LDAP backup server'), ('smtp-server', 'SMTP server'), ('postgresql-server', 'postgreSQL server'), ('mysql-server', 'mySQL server'), ('sql-client', 'SQL client'), ('gateway', 'Gateway')], max_length=32, null=True),
),
migrations.AlterField(
model_name='service',
name='min_time_regen',
field=models.DurationField(default=datetime.timedelta(0, 60), help_text='Minimal time before regeneration of the service.'),
),
migrations.AlterField(
model_name='service',
name='regular_time_regen',
field=models.DurationField(default=datetime.timedelta(0, 3600), help_text='Maximal time before regeneration of the service.'),
),
migrations.AlterField(
model_name='soa',
name='expire',
field=models.PositiveIntegerField(default=3600000, help_text='Seconds before the secondary DNS stop answering requests in case of primary DNS timeout'),
),
migrations.AlterField(
model_name='soa',
name='mail',
field=models.EmailField(help_text='Contact email address for the zone', max_length=254),
),
migrations.AlterField(
model_name='soa',
name='refresh',
field=models.PositiveIntegerField(default=86400, help_text='Seconds before the secondary DNS have to ask the primary DNS serial to detect a modification'),
),
migrations.AlterField(
model_name='soa',
name='retry',
field=models.PositiveIntegerField(default=7200, help_text='Seconds before the secondary DNS ask the serial again in case of a primary DNS timeout'),
),
migrations.AlterField(
model_name='soa',
name='ttl',
field=models.PositiveIntegerField(default=172800, help_text='Time to Live'),
),
migrations.AlterField(
model_name='srv',
name='port',
field=models.PositiveIntegerField(help_text='TCP/UDP port', validators=[django.core.validators.MaxValueValidator(65535)]),
),
migrations.AlterField(
model_name='srv',
name='priority',
field=models.PositiveIntegerField(default=0, help_text='Priority of the target server (positive integer value, the lower it is, the more the server will be used if available)', validators=[django.core.validators.MaxValueValidator(65535)]),
),
migrations.AlterField(
model_name='srv',
name='target',
field=models.ForeignKey(help_text='Target server', on_delete=django.db.models.deletion.PROTECT, to='machines.Domain'),
),
migrations.AlterField(
model_name='srv',
name='ttl',
field=models.PositiveIntegerField(default=172800, help_text='Time to Live'),
),
migrations.AlterField(
model_name='srv',
name='weight',
field=models.PositiveIntegerField(default=0, help_text='Relative weight for records with the same priority (integer value between 0 and 65535)', validators=[django.core.validators.MaxValueValidator(65535)]),
),
]
This diff is collapsed.
......@@ -23,25 +23,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Alias</th>
<th>{% trans "Aliases" %}</th>
<th></th>
</tr>
</thead>
{% for alias in alias_list %}
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% history_button alias %}
</td>
</tr>
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% history_button alias %}
</td>
</tr>
{% endfor %}
</table>
......@@ -22,16 +22,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Target zone</th>
<th>Record</th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Target zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<tr>
<td>{{ dname.zone }}</td>
<td>{{ dname.dns_entry }}</td>
......@@ -39,10 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit dname %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% acl_end %}
{% history_button dname %}
{% history_button dname %}
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</table>
......@@ -25,17 +25,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load design %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Extension</th>
<th>Droit infra pour utiliser ?</th>
<th>Enregistrement SOA</th>
<th>Enregistrement A origin</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "SOA record" %}</th>
<th>{% trans "A record origin" %}</th>
{% if ipv6_enabled %}
<th>Enregistrement AAAA origin</th>
<th>{% trans "AAAA record origin" %}</th>
{% endif %}
<th></th>
</tr>
......@@ -44,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra|tick }}</td>
<td>{{ extension.soa}}</td>
<td>{{ extension.soa }}</td>
<td>{{ extension.origin }}</td>
{% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td>
......@@ -59,3 +60,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
</div>
......@@ -26,18 +26,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Type d'ip</th>
<th>Extension</th>
<th>Nécessite l'autorisation infra</th>
<th>Plage ipv4</th>
<th>Préfixe v6</th>
<th>DNSSEC reverse v4/v6</th>
<th>Sur vlan</th>
<th>Ouverture ports par défault</th>
<th>{% trans "IP type" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "IPv4 range" %}</th>
<th>{% trans "v6 prefix" %}</th>
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
<th>{% trans "On VLAN(s)" %}</th>
<th>{% trans "Default ports opening" %}</th>
<th></th>
</tr>
</thead>
......@@ -61,3 +63,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
</div>
......@@ -24,29 +24,30 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Ipv6</th>
<th>Slaac</th>
<th>{% trans "IPv6 addresses" %}</th>
<th>{% trans "SLAAC" %}</th>
<th></th>
</tr>
</thead>
</thead>
{% for ipv6 in ipv6_list %}
<tr>
<td>{{ ipv6.ipv6 }}</td>
<td>{{ ipv6.slaac_ip }}</td>
<td class="text-right">
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% history_button ipv6 %}
</td>
</tr>