Commit 4bd0be94 authored by Maël Kervella's avatar Maël Kervella

Translate to english

parent 7631ea6c
......@@ -410,8 +410,9 @@ class DelTxtForm(FormRevMixin, Form):
else:
self.fields['txt'].queryset = Txt.objects.all()
class DNameForm(FormRevMixin, ModelForm):
"""Ajout d'un DName pour une zone"""
"""Add a DNAME entry for a zone"""
class Meta:
model = DName
fields = '__all__'
......@@ -422,10 +423,10 @@ class DNameForm(FormRevMixin, ModelForm):
class DelDNameForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs DName"""
"""Delete a set of DNAME entries"""
dnames = forms.ModelMultipleChoiceField(
queryset=Txt.objects.none(),
label="Enregistrements DName actuels",
label="Existing DNAME entries",
widget=forms.CheckboxSelectMultiple
)
......@@ -438,7 +439,6 @@ class DelDNameForm(FormRevMixin, Form):
self.fields['dnames'].queryset = DName.objects.all()
class SrvForm(FormRevMixin, ModelForm):
"""Ajout d'un srv pour une zone"""
class Meta:
......
......@@ -10,7 +10,7 @@ import re2o.mixins
class Migration(migrations.Migration):
dependencies = [
('machines', '0087_merge_20180624_1648'),
('machines', '0083_remove_duplicate_rights'),
]
operations = [
......@@ -22,7 +22,9 @@ class Migration(migrations.Migration):
('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
],
options={
'permissions': (('view_dname', 'Peut voir un objet dname'),),
'permissions': (('view_dname', 'Can see a dname object'),),
'verbose_name': 'DNAME entry',
'verbose_name_plural': 'DNAME entries'
},
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model),
),
......
......@@ -672,23 +672,23 @@ class Txt(RevMixin, AclMixin, models.Model):
class DName(RevMixin, AclMixin, models.Model):
""" Un enregistrement DName, qui crée un alias depuis la zone spécifié vers l'extension"""
PRETTY_NAME = "Enregistrement DName"
"""A DNAME entry for the DNS."""
zone = models.ForeignKey('Extension', on_delete=models.PROTECT)
alias = models.CharField(max_length=255)
class Meta:
permissions = (
("view_dname", "Peut voir un objet dname"),
("view_dname", "Can see a dname object"),
)
verbose_name = "DNAME entry"
verbose_name_plural = "DNAME entries"
def __str__(self):
return str(self.zone) + " : " + str(self.alias)
@cached_property
def dns_entry(self):
"""Renvoie l'enregisterment DNAME complet pour le fichier de zone"""
"""Returns the DNAME record for the DNS zone file."""
return str(self.alias) + " IN DNAME " + str(self.zone)
......@@ -1702,19 +1702,22 @@ def text_post_save(**_kwargs):
"""Regeneration dns après modification d'un TXT"""
regen('dns')
@receiver(post_delete, sender=Txt)
def text_post_delete(**_kwargs):
"""Regeneration dns après modification d'un TX"""
regen('dns')
@receiver(post_save, sender=DName)
def dname_post_save(**_kwargs):
"""Regeneration dns après modification d'un DName"""
"""Updates the DNS regen after modification of a DName object."""
regen('dns')
@receiver(post_delete, sender=DName)
def DName_post_delete(**_kwargs):
"""Regeneration dns après modification d'un DName"""
def dname_post_delete(**_kwargs):
"""Updates the DNS regen after deletion of a DName object."""
regen('dns')
......
......@@ -3,7 +3,7 @@ Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Charlie Jacomme
Copyright © 2018 Charlie Jacomme
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -25,21 +25,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Enregistrement</th>
<th>Target zone</th>
<th>Record</th>
<th></th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<tr>
<td>{{ dname.zone }}</td>
<td>{{ dname.dns_entry }}</td>
<td>{{ dname.zone }}</td>
<td>{{ dname.dns_entry }}</td>
<td class="text-right">
{% can_edit dname %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='dname' id=dname.id %}
{% can_edit dname %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='dname' id=dname.id %}
</td>
</tr>
{% endfor %}
......
......@@ -61,12 +61,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-txt' %}"><i class="fa fa-trash"></i> Supprimer un enregistrement TXT</a>
{% include "machines/aff_txt.html" with txt_list=txt_list %}
<h2>Liste des enregistrements DNAME</h2>
<h2>DNAME records</h2>
{% can_create DName %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-dname' %}"><i class="fa fa-plus"></i> Ajouter un enregistrement DNAME</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-dname' %}">
<i class="fa fa-plus"></i> {% trans "Add a DNAME record" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-dname' %}"><i class="fa fa-trash"></i> Supprimer un enregistrement DNAME</a>
{% include "machines/aff_dname.html" with dname_list=dname_list %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-dname' %}">
<i class="fa fa-trash"></i> {% trans "Delete DNAME records" %}
</a>
{% include "machines/aff_dname.html" with dname_list=dname_list %}
<h2>Liste des enregistrements SRV</h2>
{% can_create Srv %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-srv' %}"><i class="fa fa-plus"></i> Ajouter un enregistrement SRV</a>
......
......@@ -54,12 +54,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if nsform %}
{% bootstrap_form_errors nsform %}
{% endif %}
{% if dnameform %}
{% bootstrap_form_errors dnameform %}
{% endif %}
{% if txtform %}
{% bootstrap_form_errors txtform %}
{% endif %}
{% if dnameform %}
{% bootstrap_form_errors dnameform %}
{% endif %}
{% if srvform %}
{% bootstrap_form_errors srvform %}
{% endif %}
......@@ -126,7 +126,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% bootstrap_form txtform %}
{% endif %}
{% if dnameform %}
<h3>Enregistrement DName</h3>
<h3>DNAME record</h3>
{% bootstrap_form dnameform %}
{% endif %}
{% if srvform %}
......
......@@ -826,10 +826,10 @@ def add_dname(request):
dname = DNameForm(request.POST or None)
if dname.is_valid():
dname.save()
messages.success(request, "Cet enregistrement DName a été ajouté")
messages.success(request, "This DNAME record has been added")
return redirect(reverse('machines:index-extension'))
return form(
{'dnameform': dname, 'action_name': 'Créer'},
{'dnameform': dname, 'action_name': "Create"},
'machines/machine.html',
request
)
......@@ -843,10 +843,10 @@ def edit_dname(request, dname_instance, **_kwargs):
if dname.is_valid():
if dname.changed_data:
dname.save()
messages.success(request, "DName modifié")
messages.success(request, "DName successfully edited")
return redirect(reverse('machines:index-extension'))
return form(
{'dnameform': dname, 'action_name': 'Editer'},
{'dnameform': dname, 'action_name': "Edit"},
'machines/machine.html',
request
)
......@@ -862,16 +862,16 @@ def del_dname(request, instances):
for dname_del in dname_dels:
try:
dname_del.delete()
messages.success(request, "Le dname a été supprimé")
messages.success(request,
"The DNAME %s has been deleted" % dname_del)
except ProtectedError:
messages.error(
request,
("Erreur le dname suivant %s ne peut être supprimé"
% dname_del)
"The DNAME %s can not be deleted" % dname_del
)
return redirect(reverse('machines:index-extension'))
return form(
{'dnameform': dname, 'action_name': 'Supprimer'},
{'dnameform': dname, 'action_name': 'Delete'},
'machines/machine.html',
request
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment