diff --git a/machines/forms.py b/machines/forms.py index 8ca13311..36cd64f8 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -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: diff --git a/machines/migrations/0088_dname.py b/machines/migrations/0088_dname.py index 2b9b457b..4cbeb492 100644 --- a/machines/migrations/0088_dname.py +++ b/machines/migrations/0088_dname.py @@ -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), ), diff --git a/machines/models.py b/machines/models.py index 6a300078..6344cf91 100644 --- a/machines/models.py +++ b/machines/models.py @@ -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') diff --git a/machines/templates/machines/aff_dname.html b/machines/templates/machines/aff_dname.html index 2bd11994..17cd0457 100644 --- a/machines/templates/machines/aff_dname.html +++ b/machines/templates/machines/aff_dname.html @@ -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., - - + + {% for dname in dname_list %} - - + + {% endfor %} diff --git a/machines/templates/machines/index_extension.html b/machines/templates/machines/index_extension.html index 3ec25767..19a0fca4 100644 --- a/machines/templates/machines/index_extension.html +++ b/machines/templates/machines/index_extension.html @@ -61,12 +61,18 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %} Supprimer un enregistrement TXT {% include "machines/aff_txt.html" with txt_list=txt_list %} -

Liste des enregistrements DNAME

+ +

DNAME records

{% can_create DName %} - Ajouter un enregistrement DNAME + + {% trans "Add a DNAME record" %} + {% acl_end %} - Supprimer un enregistrement DNAME - {% include "machines/aff_dname.html" with dname_list=dname_list %} + + {% trans "Delete DNAME records" %} + + {% include "machines/aff_dname.html" with dname_list=dname_list %} +

Liste des enregistrements SRV

{% can_create Srv %} Ajouter un enregistrement SRV diff --git a/machines/templates/machines/machine.html b/machines/templates/machines/machine.html index 20dee58a..0c5a478a 100644 --- a/machines/templates/machines/machine.html +++ b/machines/templates/machines/machine.html @@ -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 %} -

Enregistrement DName

+

DNAME record

{% bootstrap_form dnameform %} {% endif %} {% if srvform %} diff --git a/machines/views.py b/machines/views.py index c36f83d8..71484952 100644 --- a/machines/views.py +++ b/machines/views.py @@ -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 )
Zone concernéeEnregistrementTarget zoneRecord
{{ dname.zone }}{{ dname.dns_entry }}{{ dname.zone }}{{ dname.dns_entry }} - {% 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 %}