From 987ba3a33b5b706e8210636d8dfa768820cba6a8 Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 11:27:35 +0200 Subject: [PATCH 1/6] Update domains when ip_type or machine_type are updated --- machines/models.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/machines/models.py b/machines/models.py index fa4db48c..cdddf98c 100644 --- a/machines/models.py +++ b/machines/models.py @@ -353,6 +353,9 @@ class MachineType(RevMixin, AclMixin, models.Model): """Get all interfaces of the current machine type (self).""" return Interface.objects.filter(machine_type=self) + def save(self, *args, **kwargs): + super(MachineType, self).save(*args, **kwargs) + @staticmethod def can_use_all(user_request, *_args, **_kwargs): """Check if an user can use all machine types. @@ -594,6 +597,10 @@ class IpType(RevMixin, AclMixin, models.Model): else: return None + def all_machine_types(self): + """Get all machine types associated with this ip type (self).""" + return MachineType.objects.filter(ip_type=self) + def clean(self): """ Check if: @@ -1417,6 +1424,10 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): interface.save() reversion.set_comment("IPv4 assignment") + def all_domains(self): + """Get all domains associated with this interface (self).""" + return Domain.objects.filter(interface_parent=self) + def update_type(self): """Reassign addresses when the IP type of the machine type changed.""" self.clean() @@ -2430,7 +2441,8 @@ def machine_post_delete(**kwargs): @receiver(post_save, sender=Interface) def interface_post_save(**kwargs): - """Synchronise LDAP and regen firewall/DHCP after an interface is edited. + """Synchronise LDAP, regen firewall/DHCP after an interface is edited + and update associated domains """ interface = kwargs["instance"] interface.sync_ipv6() @@ -2439,6 +2451,10 @@ def interface_post_save(**kwargs): # Regen services regen("dhcp") regen("mac_ip_list") + # Update associated domains + for domain in interface.all_domains(): + domain.clean() + domain.save() @receiver(post_delete, sender=Interface) @@ -2456,6 +2472,8 @@ def iptype_post_save(**kwargs): iptype = kwargs["instance"] iptype.gen_ip_range() iptype.check_replace_prefixv6() + for machinetype in iptype.all_machine_types(): + machinetype.save() @receiver(post_save, sender=MachineType) From ef33bc67c18bec136ec01634fe80b4054272e169 Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 18:49:55 +0200 Subject: [PATCH 2/6] Optimisation of domains update --- machines/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/machines/models.py b/machines/models.py index cdddf98c..0eb7e49d 100644 --- a/machines/models.py +++ b/machines/models.py @@ -2482,8 +2482,7 @@ def machinetype_post_save(**kwargs): parent IP type). """ machinetype = kwargs["instance"] - for interface in machinetype.all_interfaces(): - interface.update_type() + Domain.objects.filter(interface_parent__machine_type=machinetype).update(extension=machinetype.ip_type.extension) @receiver(post_save, sender=Domain) From 742f95f33581b562ed89fd8bdb0671f8e35fcbfa Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 19:29:44 +0200 Subject: [PATCH 3/6] Add exception handling --- machines/views.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/machines/views.py b/machines/views.py index b4059024..f3fc5f1b 100644 --- a/machines/views.py +++ b/machines/views.py @@ -35,6 +35,7 @@ from __future__ import unicode_literals from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.db.models import ProtectedError, F +from django.db import IntegrityError from django.forms import modelformset_factory from django.http import HttpResponse from django.shortcuts import render, redirect @@ -506,8 +507,11 @@ def edit_iptype(request, iptype_instance, **_kwargs): iptype = EditIpTypeForm(request.POST or None, instance=iptype_instance) if iptype.is_valid(): if iptype.changed_data: - iptype.save() - messages.success(request, _("The IP type was edited.")) + try: + iptype.save() + messages.success(request, _("The IP type was edited.")) + except IntegrityError as e: + messages.success(request, _("This IP type change would create duplicated domains")) return redirect(reverse("machines:index-iptype")) return form( {"iptypeform": iptype, "action_name": _("Edit")}, @@ -572,8 +576,11 @@ def edit_machinetype(request, machinetype_instance, **_kwargs): machinetype = MachineTypeForm(request.POST or None, instance=machinetype_instance) if machinetype.is_valid(): if machinetype.changed_data: - machinetype.save() - messages.success(request, _("The machine type was edited.")) + try: + machinetype.save() + messages.success(request, _("The machine type was edited.")) + except IntegrityError as e: + messages.error(request, _("This machine type change would create duplicated domains")) return redirect(reverse("machines:index-machinetype")) return form( {"machinetypeform": machinetype, "action_name": _("Edit")}, From cb7acd2fc7f32887cad168bf04516a69e97381b5 Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 19:50:21 +0200 Subject: [PATCH 4/6] Translation --- machines/locale/fr/LC_MESSAGES/django.po | 570 ++++++++++++----------- machines/models.py | 3 - 2 files changed, 289 insertions(+), 284 deletions(-) diff --git a/machines/locale/fr/LC_MESSAGES/django.po b/machines/locale/fr/LC_MESSAGES/django.po index 627db36f..8bdfeb7f 100644 --- a/machines/locale/fr/LC_MESSAGES/django.po +++ b/machines/locale/fr/LC_MESSAGES/django.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-17 12:49+0200\n" +"POT-Creation-Date: 2020-06-09 19:43+0200\n" "PO-Revision-Date: 2018-06-23 16:35+0200\n" "Last-Translator: Laouen Fernet \n" "Language-Team: \n" @@ -55,135 +55,135 @@ msgstr "Sélectionnez un type de machine" msgid "Automatic IPv4 assignment" msgstr "Assignation automatique IPv4" -#: machines/forms.py:172 +#: machines/forms.py:173 msgid "Current aliases" msgstr "Alias actuels" -#: machines/forms.py:194 +#: machines/forms.py:195 msgid "Machine type to add" msgstr "Type de machine à ajouter" -#: machines/forms.py:195 +#: machines/forms.py:196 msgid "Related IP type" msgstr "Type d'IP relié" -#: machines/forms.py:203 +#: machines/forms.py:204 msgid "Current machine types" msgstr "Types de machines actuels" -#: machines/forms.py:227 +#: machines/forms.py:229 msgid "IP type to add" msgstr "Type d'IP à ajouter" -#: machines/forms.py:255 +#: machines/forms.py:258 msgid "Current IP types" msgstr "Types d'IP actuels" -#: machines/forms.py:278 +#: machines/forms.py:281 msgid "Extension to add" msgstr "Extension à ajouter" -#: machines/forms.py:279 machines/templates/machines/aff_extension.html:37 +#: machines/forms.py:282 machines/templates/machines/aff_extension.html:37 msgid "A record origin" msgstr "Enregistrement A origin" -#: machines/forms.py:280 machines/templates/machines/aff_extension.html:39 +#: machines/forms.py:283 machines/templates/machines/aff_extension.html:39 msgid "AAAA record origin" msgstr "Enregistrement AAAA origin" -#: machines/forms.py:281 +#: machines/forms.py:284 msgid "SOA record to use" msgstr "Enregistrement SOA à utiliser" -#: machines/forms.py:282 +#: machines/forms.py:285 msgid "Sign with DNSSEC" msgstr "Signer avec DNSSEC" -#: machines/forms.py:290 +#: machines/forms.py:293 msgid "Current extensions" msgstr "Extensions actuelles" -#: machines/forms.py:332 +#: machines/forms.py:335 msgid "Current SOA records" msgstr "Enregistrements SOA actuels" -#: machines/forms.py:365 +#: machines/forms.py:368 msgid "Current MX records" msgstr "Enregistrements MX actuels" -#: machines/forms.py:400 +#: machines/forms.py:403 msgid "Current NS records" msgstr "Enregistrements NS actuels" -#: machines/forms.py:430 +#: machines/forms.py:433 msgid "Current TXT records" msgstr "Enregistrements TXT actuels" -#: machines/forms.py:460 +#: machines/forms.py:463 msgid "Current DNAME records" msgstr "Enregistrements DNAME actuels" -#: machines/forms.py:490 +#: machines/forms.py:493 msgid "Current SRV records" msgstr "Enregistrements SRV actuels" -#: machines/forms.py:521 +#: machines/forms.py:523 msgid "Current NAS devices" msgstr "Dispositifs NAS actuels" -#: machines/forms.py:554 +#: machines/forms.py:556 msgid "Current roles" msgstr "Rôles actuels" -#: machines/forms.py:596 +#: machines/forms.py:598 msgid "Current services" msgstr "Services actuels" -#: machines/forms.py:638 +#: machines/forms.py:640 msgid "Current VLANs" msgstr "VLANs actuels" -#: machines/models.py:71 +#: machines/models.py:76 msgid "Optional." msgstr "Optionnel." -#: machines/models.py:77 +#: machines/models.py:82 msgid "Can view a machine object" msgstr "Peut voir un objet machine" -#: machines/models.py:78 +#: machines/models.py:83 msgid "Can change the user of a machine" msgstr "Peut changer l'utilisateur d'une machine" -#: machines/models.py:80 machines/views.py:306 +#: machines/models.py:85 machines/views.py:308 msgid "machine" msgstr "machine" -#: machines/models.py:81 +#: machines/models.py:86 msgid "machines" msgstr "machines" -#: machines/models.py:106 +#: machines/models.py:110 msgid "You don't have the right to change the machine's user." msgstr "Vous n'avez pas le droit de changer l'utilisateur de la machine." -#: machines/models.py:121 +#: machines/models.py:130 msgid "You don't have the right to view all the machines." msgstr "Vous n'avez pas le droit de voir toutes les machines." -#: machines/models.py:136 +#: machines/models.py:151 msgid "Nonexistent user." msgstr "Utilisateur inexistant." -#: machines/models.py:146 machines/models.py:1295 +#: machines/models.py:161 machines/models.py:1508 msgid "You don't have the right to add a machine." msgstr "Vous n'avez pas le droit d'ajouter une machine." -#: machines/models.py:152 +#: machines/models.py:167 msgid "You don't have the right to add a machine to another user." msgstr "Vous n'avez pas le droit d'ajouter une machine à un autre utilisateur." -#: machines/models.py:159 machines/models.py:1314 +#: machines/models.py:174 machines/models.py:1527 #, python-format msgid "" "You reached the maximum number of interfaces that you are allowed to create " @@ -192,78 +192,78 @@ msgstr "" "Vous avez atteint le nombre maximal d'interfaces que vous pouvez créer vous-" "même (%s)." -#: machines/models.py:180 machines/models.py:1346 +#: machines/models.py:199 machines/models.py:1570 msgid "You don't have the right to edit a machine of another user." msgstr "" "Vous n'avez pas le droit de modifier une machine d'un autre utilisateur." -#: machines/models.py:199 +#: machines/models.py:222 msgid "You don't have the right to delete a machine of another user." msgstr "" "Vous n'avez pas le droit de supprimer une machine d'une autre utilisateur." -#: machines/models.py:218 machines/models.py:1763 +#: machines/models.py:245 machines/models.py:2061 msgid "You don't have the right to view other machines than yours." msgstr "Vous n'avez pas le droit de voir d'autres machines que les vôtres." -#: machines/models.py:231 machines/templates/machines/aff_machines.html:53 +#: machines/models.py:260 machines/templates/machines/aff_machines.html:53 msgid "No name" msgstr "Sans nom" -#: machines/models.py:308 +#: machines/models.py:346 msgid "Can view a machine type object" msgstr "Peut voir un objet type de machine" -#: machines/models.py:309 +#: machines/models.py:347 msgid "Can use all machine types" msgstr "Peut utiliser tous les types de machine" -#: machines/models.py:311 +#: machines/models.py:349 msgid "machine type" msgstr "type de machine" -#: machines/models.py:312 +#: machines/models.py:350 msgid "machine types" msgstr "types de machine" -#: machines/models.py:332 +#: machines/models.py:370 msgid "You don't have the right to use all machine types." msgstr "Vous n'avez pas le droit d'utiliser tous les types de machine." -#: machines/models.py:353 +#: machines/models.py:407 msgid "Network containing the domain's IPv4 range (optional)." msgstr "Réseau contenant la plage IPv4 du domaine (optionnel)." -#: machines/models.py:358 +#: machines/models.py:412 msgid "Netmask for the domain's IPv4 range." msgstr "Masque de sous-réseau pour la plage IPv4 du domaine." -#: machines/models.py:361 +#: machines/models.py:415 msgid "Enable reverse DNS for IPv4." msgstr "Activer DNS inverse pour IPv4." -#: machines/models.py:368 +#: machines/models.py:422 msgid "Enable reverse DNS for IPv6." msgstr "Activer DNS inverse pour IPv6." -#: machines/models.py:375 +#: machines/models.py:429 msgid "Can view an IP type object" msgstr "Peut voir un objet type d'IP" -#: machines/models.py:376 +#: machines/models.py:430 msgid "Can use all IP types" msgstr "Peut utiliser tous les types d'IP" -#: machines/models.py:378 machines/templates/machines/aff_iptype.html:35 +#: machines/models.py:432 machines/templates/machines/aff_iptype.html:35 #: machines/templates/machines/machine.html:108 msgid "IP type" msgstr "type d'IP" -#: machines/models.py:379 +#: machines/models.py:433 msgid "IP types" msgstr "types d'IP" -#: machines/models.py:488 +#: machines/models.py:549 msgid "" "One or several IP addresses from the range are affected, impossible to " "delete the range." @@ -271,25 +271,25 @@ msgstr "" "Une ou plusieurs adresses IP de la plage sont affectées, impossible de " "supprimer la plage." -#: machines/models.py:535 +#: machines/models.py:610 msgid "Domaine IPv4 start and stop must be valid" msgstr "Les valeurs IPv4 Domaine ip start et stop doivent être valides" -#: machines/models.py:537 +#: machines/models.py:612 msgid "Range end must be after range start..." msgstr "La fin de la plage doit être après le début..." -#: machines/models.py:542 +#: machines/models.py:617 msgid "The range is too large, you can't create a larger one than a /16." msgstr "" "La plage est trop grande, vous ne pouvez pas en créer une plus grande " "qu'un /16." -#: machines/models.py:550 +#: machines/models.py:625 msgid "The specified range is not disjoint from existing ranges." msgstr "La plage renseignée n'est pas disjointe des plages existantes." -#: machines/models.py:563 +#: machines/models.py:638 msgid "" "If you specify a domain network or netmask, it must contain the domain's IP " "range." @@ -297,47 +297,47 @@ msgstr "" "Si vous renseignez un réseau ou masque de sous-réseau, il doit contenir la " "plage IP du domaine." -#: machines/models.py:601 +#: machines/models.py:693 msgid "v4 multicast management." msgstr "gestion de multidiffusion v4." -#: machines/models.py:602 +#: machines/models.py:694 msgid "v6 multicast management." msgstr "gestion de multidiffusion v6." -#: machines/models.py:605 +#: machines/models.py:697 msgid "Can view a VLAN object" msgstr "Peut voir un objet VLAN" -#: machines/models.py:606 machines/templates/machines/machine.html:160 +#: machines/models.py:698 machines/templates/machines/machine.html:160 msgid "VLAN" msgstr "VLAN" -#: machines/models.py:607 machines/templates/machines/sidebar.html:57 +#: machines/models.py:699 machines/templates/machines/sidebar.html:57 msgid "VLANs" msgstr "VLANs" -#: machines/models.py:619 +#: machines/models.py:718 msgid "MAC-address" msgstr "MAC-address" -#: machines/models.py:634 +#: machines/models.py:733 msgid "Can view a NAS device object" msgstr "Peut voir un objet dispositif NAS" -#: machines/models.py:635 machines/templates/machines/machine.html:164 +#: machines/models.py:734 machines/templates/machines/machine.html:164 msgid "NAS device" msgstr "dispositif NAS" -#: machines/models.py:636 machines/templates/machines/sidebar.html:63 +#: machines/models.py:735 machines/templates/machines/sidebar.html:63 msgid "NAS devices" msgstr "dispositifs NAS" -#: machines/models.py:650 +#: machines/models.py:760 msgid "Contact email address for the zone." msgstr "Adresse mail de contact pour la zone." -#: machines/models.py:654 +#: machines/models.py:764 msgid "" "Seconds before the secondary DNS have to ask the primary DNS serial to " "detect a modification." @@ -345,7 +345,7 @@ msgstr "" "Secondes avant que le DNS secondaire demande au DNS primaire le serial pour " "détecter une modification." -#: machines/models.py:661 +#: machines/models.py:771 msgid "" "Seconds before the secondary DNS ask the serial again in case of a primary " "DNS timeout." @@ -353,7 +353,7 @@ msgstr "" "Secondes avant que le DNS secondaire demande le serial de nouveau dans le " "cas d'un délai d'attente du DNS primaire." -#: machines/models.py:668 +#: machines/models.py:778 msgid "" "Seconds before the secondary DNS stop answering requests in case of primary " "DNS timeout." @@ -361,121 +361,121 @@ msgstr "" "Secondes avant que le DNS secondaire arrête de répondre aux requêtes dans le " "cas d'un délai d'attente du DNS primaire." -#: machines/models.py:673 machines/models.py:940 +#: machines/models.py:783 machines/models.py:1110 msgid "Time To Live." msgstr "Temps de vie" -#: machines/models.py:677 +#: machines/models.py:787 msgid "Can view an SOA record object" msgstr "Peut voir un objet enregistrement SOA" -#: machines/models.py:678 machines/templates/machines/aff_extension.html:36 +#: machines/models.py:788 machines/templates/machines/aff_extension.html:36 #: machines/templates/machines/machine.html:120 msgid "SOA record" msgstr "enregistrement SOA" -#: machines/models.py:679 +#: machines/models.py:789 msgid "SOA records" msgstr "enregistrements SOA" -#: machines/models.py:718 +#: machines/models.py:829 msgid "SOA to edit" msgstr "SOA à modifier" -#: machines/models.py:729 +#: machines/models.py:849 msgid "Zone name, must begin with a dot (.example.org)." msgstr "Nom de zone, doit commencer par un point (.example.org)." -#: machines/models.py:737 +#: machines/models.py:857 msgid "A record associated with the zone." msgstr "Enregistrement A associé à la zone." -#: machines/models.py:743 +#: machines/models.py:863 msgid "AAAA record associated with the zone." msgstr "Enregristrement AAAA associé avec la zone." -#: machines/models.py:747 +#: machines/models.py:867 msgid "Should the zone be signed with DNSSEC." msgstr "La zone doit-elle être signée avec DNSSEC." -#: machines/models.py:752 +#: machines/models.py:872 msgid "Can view an extension object" msgstr "Peut voir un objet extension" -#: machines/models.py:753 +#: machines/models.py:873 msgid "Can use all extensions" msgstr "Peut utiliser toutes les extensions" -#: machines/models.py:755 +#: machines/models.py:875 msgid "DNS extension" msgstr "extension DNS" -#: machines/models.py:756 +#: machines/models.py:876 msgid "DNS extensions" msgstr "extensions DNS" -#: machines/models.py:816 +#: machines/models.py:946 msgid "You don't have the right to use all extensions." msgstr "Vous n'avez pas le droit d'utiliser toutes les extensions." -#: machines/models.py:825 +#: machines/models.py:955 msgid "An extension must begin with a dot." msgstr "Une extension doit commencer par un point." -#: machines/models.py:838 machines/models.py:864 machines/models.py:888 -#: machines/models.py:911 machines/models.py:1588 +#: machines/models.py:975 machines/models.py:1007 machines/models.py:1039 +#: machines/models.py:1069 machines/models.py:1858 msgid "Time To Live (TTL)" msgstr "Temps de vie (TTL)" -#: machines/models.py:842 +#: machines/models.py:979 msgid "Can view an MX record object" msgstr "Peut voir un objet enregistrement MX" -#: machines/models.py:843 machines/templates/machines/machine.html:124 +#: machines/models.py:980 machines/templates/machines/machine.html:124 msgid "MX record" msgstr "enregistrement MX" -#: machines/models.py:844 +#: machines/models.py:981 msgid "MX records" msgstr "enregistrements MX" -#: machines/models.py:868 +#: machines/models.py:1011 msgid "Can view an NS record object" msgstr "Peut voir un objet enregistrement NS" -#: machines/models.py:869 machines/templates/machines/machine.html:128 +#: machines/models.py:1012 machines/templates/machines/machine.html:128 msgid "NS record" msgstr "enregistrement NS" -#: machines/models.py:870 +#: machines/models.py:1013 msgid "NS records" msgstr "enregistrements NS" -#: machines/models.py:892 +#: machines/models.py:1043 msgid "Can view a TXT record object" msgstr "Peut voir un objet enregistrement TXT" -#: machines/models.py:893 machines/templates/machines/machine.html:132 +#: machines/models.py:1044 machines/templates/machines/machine.html:132 msgid "TXT record" msgstr "enregistrement TXT" -#: machines/models.py:894 +#: machines/models.py:1045 msgid "TXT records" msgstr "enregistrements TXT" -#: machines/models.py:915 +#: machines/models.py:1073 msgid "Can view a DNAME record object" msgstr "Peut voir un objet enregistrement DNAME" -#: machines/models.py:916 machines/templates/machines/machine.html:136 +#: machines/models.py:1074 machines/templates/machines/machine.html:136 msgid "DNAME record" msgstr "enregistrement DNAME" -#: machines/models.py:917 +#: machines/models.py:1075 msgid "DNAME records" msgstr "enregistrements DNAME" -#: machines/models.py:946 +#: machines/models.py:1116 msgid "" "Priority of the target server (positive integer value, the lower it is, the " "more the server will be used if available)." @@ -483,7 +483,7 @@ msgstr "" "Priorité du serveur cible (entier positif, plus il est bas, plus le serveur " "sera utilisé si disponible)." -#: machines/models.py:955 +#: machines/models.py:1125 msgid "" "Relative weight for records with the same priority (integer value between 0 " "and 65535)." @@ -491,164 +491,164 @@ msgstr "" "Poids relatif des enregistrements avec la même priorité (entier entre 0 et " "65535)." -#: machines/models.py:960 +#: machines/models.py:1130 msgid "TCP/UDP port." msgstr "Port TCP/UDP." -#: machines/models.py:963 +#: machines/models.py:1133 msgid "Target server." msgstr "Serveur cible." -#: machines/models.py:967 +#: machines/models.py:1137 msgid "Can view an SRV record object" msgstr "Peut voir un objet enregistrement SRV" -#: machines/models.py:968 machines/templates/machines/machine.html:140 +#: machines/models.py:1138 machines/templates/machines/machine.html:140 msgid "SRV record" msgstr "enregistrement SRV" -#: machines/models.py:969 +#: machines/models.py:1139 msgid "SRV records" msgstr "enregistrements SRV" -#: machines/models.py:1020 +#: machines/models.py:1198 msgid "SSH public key." msgstr "Clé publique SSH." -#: machines/models.py:1023 +#: machines/models.py:1201 msgid "Comment." msgstr "Commentaire." -#: machines/models.py:1046 +#: machines/models.py:1226 msgid "Can view an SSHFP record object" msgstr "Peut voir un objet enregistrement SSHFP" -#: machines/models.py:1047 machines/templates/machines/machine.html:144 -#: machines/views.py:474 +#: machines/models.py:1227 machines/templates/machines/machine.html:144 +#: machines/views.py:477 msgid "SSHFP record" msgstr "enregistrement SSHFP" -#: machines/models.py:1048 +#: machines/models.py:1228 msgid "SSHFP records" msgstr "enregistrements SSHFP" -#: machines/models.py:1083 +#: machines/models.py:1266 msgid "Can view an interface object" msgstr "Peut voir un objet interface" -#: machines/models.py:1084 +#: machines/models.py:1267 msgid "Can change the owner of an interface" msgstr "Peut changer l'utilisateur d'une interface" -#: machines/models.py:1086 machines/views.py:358 +#: machines/models.py:1269 machines/views.py:361 msgid "interface" msgstr "interface" -#: machines/models.py:1087 +#: machines/models.py:1270 msgid "interfaces" msgstr "interfaces" -#: machines/models.py:1125 +#: machines/models.py:1313 msgid "Unknown vendor." msgstr "Constructeur inconnu." -#: machines/models.py:1189 +#: machines/models.py:1383 msgid "The given MAC address is invalid." msgstr "L'adresse MAC indiquée est invalide." -#: machines/models.py:1198 +#: machines/models.py:1392 msgid "There are no IP addresses available in the slash." msgstr "Il n'y a pas d'adresses IP disponibles dans le slash." -#: machines/models.py:1250 +#: machines/models.py:1457 msgid "The selected IP type is invalid." msgstr "Le type d'IP sélectionné est invalide." -#: machines/models.py:1264 +#: machines/models.py:1471 msgid "MAC address already registered in this machine type/subnet." msgstr "Adresse MAC déjà enregistrée dans ce type de machine/sous-réseau." -#: machines/models.py:1273 +#: machines/models.py:1480 msgid "The IPv4 address and the machine type don't match." msgstr "L'adresse IPv4 et le type de machine ne correspondent pas." -#: machines/models.py:1288 +#: machines/models.py:1501 msgid "Nonexistent machine." msgstr "Machine inexistante." -#: machines/models.py:1305 +#: machines/models.py:1518 msgid "" "You don't have the right to add an interface to a machine of another user." msgstr "" "Vous n'avez pas le droit d'ajouter une interface à une machine d'un autre " "utilisateur." -#: machines/models.py:1329 +#: machines/models.py:1548 msgid "You don't have the right to edit the machine." msgstr "Vous n'avez pas le droit d'éditer une machine." -#: machines/models.py:1365 +#: machines/models.py:1594 msgid "You don't have the right to delete interfaces of another user." msgstr "" "Vous n'avez pas le droit de supprimer une interface d'une autre utilisateur." -#: machines/models.py:1384 +#: machines/models.py:1618 msgid "You don't have the right to view interfaces other than yours." msgstr "Vous n'avez pas le droit de voir d'autres interfaces que les vôtres." -#: machines/models.py:1412 +#: machines/models.py:1652 msgid "Can view an IPv6 addresses list object" msgstr "Peut voir un objet list d'adresses IPv6" -#: machines/models.py:1415 +#: machines/models.py:1655 msgid "Can change the SLAAC value of an IPv6 addresses list" msgstr "Peut modifier la valeur SLAAC d'une liste d'adresses IPv6" -#: machines/models.py:1418 machines/views.py:418 +#: machines/models.py:1658 machines/views.py:421 msgid "IPv6 addresses list" msgstr "Liste d'adresses IPv6" -#: machines/models.py:1419 +#: machines/models.py:1659 msgid "IPv6 addresses lists" msgstr "Listes d'adresses IPv6" -#: machines/models.py:1431 machines/models.py:1678 +#: machines/models.py:1677 machines/models.py:1961 msgid "Nonexistent interface." msgstr "Interface inexistante." -#: machines/models.py:1437 +#: machines/models.py:1683 msgid "You don't have the right to add ipv6 to a machine of another user." msgstr "" "Vous n'avez pas le droit d'ajouter des ipv6 à une machine d'un autre " "utilisateur." -#: machines/models.py:1450 +#: machines/models.py:1696 msgid "You don't have the right to change the SLAAC value of an IPv6 address." msgstr "" "Vous n'avez pas le droit de changer la valeur SLAAC d'une adresse IPv6." -#: machines/models.py:1470 +#: machines/models.py:1721 msgid "You don't have the right to edit ipv6 of a machine of another user." msgstr "" "Vous n'avez pas le droit de modifier les ipv6 d'une machine d'un autre " "utilisateur." -#: machines/models.py:1490 +#: machines/models.py:1746 msgid "You don't have the right to delete ipv6 of a machine of another user." msgstr "" "Vous n'avez pas le droit de supprimer les ipv6 d'une machine d'une autre " "utilisateur." -#: machines/models.py:1509 +#: machines/models.py:1770 msgid "You don't have the right to view ipv6 of machines other than yours." msgstr "" "Vous n'avez pas le droit de voir les ipv6 d'autres machines que les vôtres." -#: machines/models.py:1542 +#: machines/models.py:1803 msgid "A SLAAC IP address is already registered." msgstr "Une adresse IP SLAAC est déjà enregistrée." -#: machines/models.py:1556 +#: machines/models.py:1817 msgid "" "The v6 prefix is incorrect and doesn't match the type associated with the " "machine." @@ -656,55 +656,55 @@ msgstr "" "Le préfixe v6 est incorrect et ne correspond pas au type associé à la " "machine." -#: machines/models.py:1581 +#: machines/models.py:1851 msgid "Mandatory and unique, must not contain dots." msgstr "Obligatoire et unique, ne doit pas contenir de points." -#: machines/models.py:1596 +#: machines/models.py:1866 msgid "Can view a domain object" msgstr "Peut voir un objet domaine" -#: machines/models.py:1597 +#: machines/models.py:1867 msgid "Can change the TTL of a domain object" msgstr "Peut changer le TTL d'un objet domaine" -#: machines/models.py:1599 +#: machines/models.py:1869 msgid "domain" msgstr "domaine" -#: machines/models.py:1600 +#: machines/models.py:1870 msgid "domains" msgstr "domaines" -#: machines/models.py:1622 +#: machines/models.py:1897 msgid "You can't create a both A and CNAME record." msgstr "Vous ne pouvez pas créer un enregistrement à la fois A et CNAME." -#: machines/models.py:1625 +#: machines/models.py:1900 msgid "You can't create a CNAME record pointing to itself." msgstr "Vous ne pouvez pas créer un enregistrement CNAME vers lui-même." -#: machines/models.py:1631 +#: machines/models.py:1906 #, python-format msgid "The domain name %s is too long (over 63 characters)." msgstr "Le nom de domaine %s est trop long (plus de 63 caractères)." -#: machines/models.py:1635 +#: machines/models.py:1910 #, python-format msgid "The domain name %s contains forbidden characters." msgstr "Le nom de domaine %s contient des caractères interdits." -#: machines/models.py:1652 +#: machines/models.py:1928 msgid "Invalid extension." msgstr "Extension invalide." -#: machines/models.py:1687 +#: machines/models.py:1970 msgid "You don't have the right to add an alias to a machine of another user." msgstr "" "Vous n'avez pas le droit d'ajouter un alias à une machine d'un autre " "utilisateur." -#: machines/models.py:1703 +#: machines/models.py:1986 #, python-format msgid "" "You reached the maximum number of alias that you are allowed to create " @@ -713,164 +713,164 @@ msgstr "" "Vous avez atteint le nombre maximal d'alias que vous pouvez créer vous-même " "(%s)." -#: machines/models.py:1724 +#: machines/models.py:2012 msgid "You don't have the right to edit an alias of a machine of another user." msgstr "" "Vous n'avez pas le droit de modifier un alias d'une machine d'un autre " "utilisateur." -#: machines/models.py:1744 +#: machines/models.py:2037 msgid "" "You don't have the right to delete an alias of a machine of another user." msgstr "" "Vous n'avez pas le droit de supprimer un alias d'une machine d'un autre " "utilisateur." -#: machines/models.py:1773 +#: machines/models.py:2072 msgid "You don't have the right to change the domain's TTL." msgstr "Vous n'avez pas le droit de changer le TTL du domaine." -#: machines/models.py:1790 +#: machines/models.py:2094 msgid "Can view an IPv4 addresses list object" msgstr "Peut voir un object liste d'adresses IPv4" -#: machines/models.py:1791 +#: machines/models.py:2095 msgid "IPv4 addresses list" msgstr "Liste d'adresses IPv4" -#: machines/models.py:1792 +#: machines/models.py:2096 msgid "IPv4 addresses lists" msgstr "Listes d'adresses IPv4" -#: machines/models.py:1804 +#: machines/models.py:2113 msgid "The IPv4 address and the range of the IP type don't match." msgstr "L'adresse IPv4 et la plage du type d'IP ne correspondent pas." -#: machines/models.py:1822 +#: machines/models.py:2137 msgid "DHCP server" msgstr "Serveur DHCP" -#: machines/models.py:1823 +#: machines/models.py:2138 msgid "Switches configuration server" msgstr "Serveur de configuration des commutateurs réseau" -#: machines/models.py:1824 +#: machines/models.py:2139 msgid "Recursive DNS server" msgstr "Serveur DNS récursif" -#: machines/models.py:1825 +#: machines/models.py:2140 msgid "NTP server" msgstr "Serveur NTP" -#: machines/models.py:1826 +#: machines/models.py:2141 msgid "RADIUS server" msgstr "Serveur RADIUS" -#: machines/models.py:1827 +#: machines/models.py:2142 msgid "Log server" msgstr "Serveur log" -#: machines/models.py:1828 +#: machines/models.py:2143 msgid "LDAP master server" msgstr "Serveur LDAP maître" -#: machines/models.py:1829 +#: machines/models.py:2144 msgid "LDAP backup server" msgstr "Serveur LDAP de secours" -#: machines/models.py:1830 +#: machines/models.py:2145 msgid "SMTP server" msgstr "Serveur SMTP" -#: machines/models.py:1831 +#: machines/models.py:2146 msgid "postgreSQL server" msgstr "Serveur postgreSQL" -#: machines/models.py:1832 +#: machines/models.py:2147 msgid "mySQL server" msgstr "Serveur mySQL" -#: machines/models.py:1833 +#: machines/models.py:2148 msgid "SQL client" msgstr "Client SQL" -#: machines/models.py:1834 +#: machines/models.py:2149 msgid "Gateway" msgstr "Passerelle" -#: machines/models.py:1842 +#: machines/models.py:2157 msgid "Can view a role object" msgstr "Peut voir un objet rôle" -#: machines/models.py:1843 +#: machines/models.py:2158 msgid "server role" msgstr "rôle de serveur" -#: machines/models.py:1844 +#: machines/models.py:2159 msgid "server roles" msgstr "rôles de serveur" -#: machines/models.py:1876 +#: machines/models.py:2198 msgid "Minimal time before regeneration of the service." msgstr "Temps minimal avant régénération du service." -#: machines/models.py:1880 +#: machines/models.py:2202 msgid "Maximal time before regeneration of the service." msgstr "Temps maximal avant régénération du service." -#: machines/models.py:1885 +#: machines/models.py:2207 msgid "Can view a service object" msgstr "Peut voir un objet service" -#: machines/models.py:1886 +#: machines/models.py:2208 msgid "service to generate (DHCP, DNS, ...)" msgstr "service à générer (DHCP, DNS, ...)" -#: machines/models.py:1887 +#: machines/models.py:2209 msgid "services to generate (DHCP, DNS, ...)" msgstr "services à générer (DHCP, DNS, ...)" -#: machines/models.py:1931 +#: machines/models.py:2266 msgid "Can view a service server link object" msgstr "Peut voir un objet lien service serveur" -#: machines/models.py:1933 +#: machines/models.py:2268 msgid "link between service and server" msgstr "lien entre service et serveur" -#: machines/models.py:1934 +#: machines/models.py:2269 msgid "links between service and server" msgstr "liens entre service et serveur" -#: machines/models.py:1975 +#: machines/models.py:2316 msgid "Name of the ports configuration" msgstr "Nom de la configuration de ports" -#: machines/models.py:1980 +#: machines/models.py:2321 msgid "Can view a ports opening list object" msgstr "Peut voir un objet liste d'ouverture de ports" -#: machines/models.py:1982 +#: machines/models.py:2323 msgid "ports opening list" msgstr "liste d'ouverture de ports" -#: machines/models.py:1983 +#: machines/models.py:2324 msgid "ports opening lists" msgstr "listes d'ouverture de ports" -#: machines/models.py:1994 +#: machines/models.py:2339 msgid "You don't have the right to delete a ports opening list." msgstr "Vous n'avez pas le droit de supprimer une liste d'ouverture de ports." -#: machines/models.py:1998 +#: machines/models.py:2343 msgid "This ports opening list is used." msgstr "Cette liste d'ouverture de ports est utilisée." -#: machines/models.py:2052 +#: machines/models.py:2407 msgid "ports opening" msgstr "ouverture de ports" -#: machines/models.py:2053 +#: machines/models.py:2408 msgid "ports openings" msgstr "ouvertures de ports" @@ -982,13 +982,13 @@ msgstr "Afficher le constructeur" msgid "Display the IPv6 address" msgstr "Afficher les adresses IPv6" -#: machines/templates/machines/aff_machines.html:126 machines/views.py:288 -#: machines/views.py:402 machines/views.py:458 machines/views.py:509 -#: machines/views.py:572 machines/views.py:635 machines/views.py:697 -#: machines/views.py:749 machines/views.py:801 machines/views.py:853 -#: machines/views.py:908 machines/views.py:960 machines/views.py:1022 -#: machines/views.py:1078 machines/views.py:1130 machines/views.py:1196 -#: machines/views.py:1248 machines/views.py:1564 +#: machines/templates/machines/aff_machines.html:126 machines/views.py:290 +#: machines/views.py:405 machines/views.py:461 machines/views.py:517 +#: machines/views.py:586 machines/views.py:649 machines/views.py:711 +#: machines/views.py:763 machines/views.py:815 machines/views.py:867 +#: machines/views.py:922 machines/views.py:974 machines/views.py:1036 +#: machines/views.py:1092 machines/views.py:1144 machines/views.py:1210 +#: machines/views.py:1262 machines/views.py:1580 msgid "Edit" msgstr "Modifier" @@ -1463,76 +1463,80 @@ msgstr "Rôles de serveur" msgid "Ports openings" msgstr "Ouvertures de ports" -#: machines/views.py:142 +#: machines/views.py:143 msgid "Select a machine type first." msgstr "Sélectionnez un type de machine d'abord." -#: machines/views.py:233 +#: machines/views.py:235 msgid "The machine was created." msgstr "La machine a été créée." -#: machines/views.py:242 machines/views.py:337 machines/views.py:378 -#: machines/views.py:436 machines/views.py:490 machines/views.py:555 -#: machines/views.py:618 machines/views.py:680 machines/views.py:732 -#: machines/views.py:784 machines/views.py:836 machines/views.py:891 -#: machines/views.py:943 machines/views.py:1000 machines/views.py:1061 -#: machines/views.py:1113 machines/views.py:1179 machines/views.py:1231 +#: machines/views.py:244 machines/views.py:340 machines/views.py:381 +#: machines/views.py:439 machines/views.py:494 machines/views.py:566 +#: machines/views.py:632 machines/views.py:694 machines/views.py:746 +#: machines/views.py:798 machines/views.py:850 machines/views.py:905 +#: machines/views.py:957 machines/views.py:1014 machines/views.py:1075 +#: machines/views.py:1127 machines/views.py:1193 machines/views.py:1245 msgid "Add" msgstr "Ajouter" -#: machines/views.py:274 +#: machines/views.py:276 msgid "The machine was edited." msgstr "La machine a été modifiée." -#: machines/views.py:301 +#: machines/views.py:303 msgid "The machine was deleted." msgstr "La machine a été supprimée." -#: machines/views.py:327 +#: machines/views.py:330 msgid "The interface was created." msgstr "L'interface a été créée." -#: machines/views.py:353 +#: machines/views.py:356 msgid "The interface was deleted." msgstr "L'interface a été supprimée." -#: machines/views.py:373 +#: machines/views.py:376 msgid "The IPv6 addresses list was created." msgstr "La liste d'adresses IPv6 a été créée." -#: machines/views.py:394 +#: machines/views.py:397 msgid "The IPv6 addresses list was edited." msgstr "La liste d'adresses IPv6 a été modifiée." -#: machines/views.py:413 +#: machines/views.py:416 msgid "The IPv6 addresses list was deleted." msgstr "La liste d'adresses IPv6 a été supprimée." -#: machines/views.py:431 +#: machines/views.py:434 msgid "The SSHFP record was created." msgstr "L'enregistrement SSHFP a été créé." -#: machines/views.py:450 +#: machines/views.py:453 msgid "The SSHFP record was edited." msgstr "L'enregistrement SSHFP a été modifié." -#: machines/views.py:469 +#: machines/views.py:472 msgid "The SSHFP record was deleted." msgstr "L'enregistrement SSHFP a été supprimé." -#: machines/views.py:487 +#: machines/views.py:491 msgid "The IP type was created." msgstr "Le type d'IP a été créé." -#: machines/views.py:506 +#: machines/views.py:512 msgid "The IP type was edited." msgstr "Le type d'IP a été modifié." -#: machines/views.py:525 +#: machines/views.py:514 +msgid "This IP type change would create duplicated domains" +msgstr "Ce changement de type d'IP causerait des duplications de noms de domaine" + +#: machines/views.py:536 msgid "The IP type was deleted." msgstr "Le type d'IP a été supprimé." -#: machines/views.py:531 +#: machines/views.py:542 #, python-format msgid "" "The IP type %s is assigned to at least one machine, you can't delete it." @@ -1540,27 +1544,31 @@ msgstr "" "Le type d'IP %s est assigné à au moins une machine, vous ne pouvez pas le " "supprimer." -#: machines/views.py:539 machines/views.py:602 machines/views.py:664 -#: machines/views.py:718 machines/views.py:770 machines/views.py:822 -#: machines/views.py:875 machines/views.py:929 machines/views.py:981 -#: machines/views.py:1045 machines/views.py:1099 machines/views.py:1154 -#: machines/views.py:1217 machines/views.py:1269 +#: machines/views.py:550 machines/views.py:616 machines/views.py:678 +#: machines/views.py:732 machines/views.py:784 machines/views.py:836 +#: machines/views.py:889 machines/views.py:943 machines/views.py:995 +#: machines/views.py:1059 machines/views.py:1113 machines/views.py:1168 +#: machines/views.py:1231 machines/views.py:1283 msgid "Delete" msgstr "Supprimer" -#: machines/views.py:552 +#: machines/views.py:563 msgid "The machine type was created." msgstr "Le type de machine a été créé." -#: machines/views.py:569 +#: machines/views.py:581 msgid "The machine type was edited." msgstr "Le type de machine a été modifié." -#: machines/views.py:588 +#: machines/views.py:583 +msgid "This machine type change would create duplicated domains" +msgstr "Ce changement de type de machine causerait des duplications de noms de domaines" + +#: machines/views.py:602 msgid "The machine type was deleted." msgstr "Le type de machine a été supprimé." -#: machines/views.py:594 +#: machines/views.py:608 #, python-format msgid "" "The machine type %s is assigned to at least one machine, you can't delete it." @@ -1568,19 +1576,19 @@ msgstr "" "Le type de machine %s est assigné à au moins un machine, vous ne pouvez pas " "le supprimer." -#: machines/views.py:615 +#: machines/views.py:629 msgid "The extension was created." msgstr "L'extension a été créée." -#: machines/views.py:632 +#: machines/views.py:646 msgid "The extension was edited." msgstr "L'extension a été modifiée." -#: machines/views.py:651 +#: machines/views.py:665 msgid "The extension was deleted." msgstr "L'extension a été supprimée." -#: machines/views.py:657 +#: machines/views.py:671 #, python-format msgid "" "The extension %s is assigned to at least one machine type, you can't delete " @@ -1589,207 +1597,207 @@ msgstr "" "L'extension %s est assignée à au moins un type de machine, vous ne pouvez " "pas le supprimer." -#: machines/views.py:677 +#: machines/views.py:691 msgid "The SOA record was created." msgstr "L'enregistrement SOA a été créé." -#: machines/views.py:694 +#: machines/views.py:708 msgid "The SOA record was edited." msgstr "L'enregistrement SOA a été modifié." -#: machines/views.py:711 +#: machines/views.py:725 msgid "The SOA record was deleted." msgstr "L'enregistrement SOA a été supprimé." -#: machines/views.py:714 +#: machines/views.py:728 #, python-format msgid "Error: the SOA record %s can't be deleted." msgstr "Erreur : l'enregistrement SOA %s ne peut pas être supprimé." -#: machines/views.py:729 +#: machines/views.py:743 msgid "The MX record was created." msgstr "L'enregistrement MX a été créé." -#: machines/views.py:746 +#: machines/views.py:760 msgid "The MX record was edited." msgstr "L'enregistrement MX a été modifié." -#: machines/views.py:763 +#: machines/views.py:777 msgid "The MX record was deleted." msgstr "L'enregistrement MX a été supprimé." -#: machines/views.py:766 +#: machines/views.py:780 #, python-format msgid "Error: the MX record %s can't be deleted." msgstr "Erreur : l'enregistrement MX %s ne peut pas être supprimé." -#: machines/views.py:781 +#: machines/views.py:795 msgid "The NS record was created." msgstr "L'enregistrement NS a été créé." -#: machines/views.py:798 +#: machines/views.py:812 msgid "The NS record was edited." msgstr "L'enregistrement NS a été modifié." -#: machines/views.py:815 +#: machines/views.py:829 msgid "The NS record was deleted." msgstr "L'enregistrement NS a été supprimé." -#: machines/views.py:818 +#: machines/views.py:832 #, python-format msgid "Error: the NS record %s can't be deleted." msgstr "Erreur : l'enregistrement NS %s ne peut pas être supprimé." -#: machines/views.py:833 +#: machines/views.py:847 msgid "The DNAME record was created." msgstr "L'enregistrement DNAME a été créé." -#: machines/views.py:850 +#: machines/views.py:864 msgid "The DNAME record was edited." msgstr "L'enregistrement DNAME a été modifié." -#: machines/views.py:867 +#: machines/views.py:881 msgid "The DNAME record was deleted." msgstr "L'enregistrement DNAME a été supprimé." -#: machines/views.py:871 +#: machines/views.py:885 #, python-format msgid "Error: the DNAME record %s can't be deleted." msgstr "Erreur : l'enregistrement DNAME %s ne peut pas être supprimé." -#: machines/views.py:888 +#: machines/views.py:902 msgid "The TXT record was created." msgstr "L'enregistrement TXT a été créé." -#: machines/views.py:905 +#: machines/views.py:919 msgid "The TXT record was edited." msgstr "L'enregistrement TXT a été modifié." -#: machines/views.py:922 +#: machines/views.py:936 msgid "The TXT record was deleted." msgstr "L'enregistrement TXT a été supprimé." -#: machines/views.py:925 +#: machines/views.py:939 #, python-format msgid "Error: the TXT record %s can't be deleted." msgstr "Erreur : l'enregistrement %s ne peut pas être supprimé." -#: machines/views.py:940 +#: machines/views.py:954 msgid "The SRV record was created." msgstr "L'enregistrement SRV a été créé." -#: machines/views.py:957 +#: machines/views.py:971 msgid "The SRV record was edited." msgstr "L'enregistrement SRV a été modifié." -#: machines/views.py:974 +#: machines/views.py:988 msgid "The SRV record was deleted." msgstr "L'enregistrement SRV a été supprimé." -#: machines/views.py:977 +#: machines/views.py:991 #, python-format msgid "Error: the SRV record %s can't be deleted." msgstr "Erreur : l'enregistrement SRV %s ne peut pas être supprimé." -#: machines/views.py:995 +#: machines/views.py:1009 msgid "The alias was created." msgstr "L'alias a été créé." -#: machines/views.py:1014 +#: machines/views.py:1028 msgid "The alias was edited." msgstr "L'alias a été modifié." -#: machines/views.py:1036 +#: machines/views.py:1050 #, python-format msgid "The alias %s was deleted." msgstr "L'alias %s a été supprimé." -#: machines/views.py:1039 +#: machines/views.py:1053 #, python-format msgid "Error: the alias %s can't be deleted." msgstr "Erreur : l'alias %s ne peut pas être supprimé." -#: machines/views.py:1058 +#: machines/views.py:1072 msgid "The role was created." msgstr "Le rôle a été créé." -#: machines/views.py:1075 +#: machines/views.py:1089 msgid "The role was edited." msgstr "Le rôle a été modifié." -#: machines/views.py:1092 +#: machines/views.py:1106 msgid "The role was deleted." msgstr "Le rôle a été supprimé." -#: machines/views.py:1095 +#: machines/views.py:1109 #, python-format msgid "Error: the role %s can't be deleted." msgstr "Erreur : le rôle %s ne peut pas être supprimé." -#: machines/views.py:1110 +#: machines/views.py:1124 msgid "The service was created." msgstr "Le service a été créé." -#: machines/views.py:1127 +#: machines/views.py:1141 msgid "The service was edited." msgstr "Le service a été modifié." -#: machines/views.py:1146 +#: machines/views.py:1160 msgid "The service was deleted." msgstr "Le service a été supprimé." -#: machines/views.py:1150 +#: machines/views.py:1164 #, python-format msgid "Error: the service %s can't be deleted." msgstr "Erreur : le service %s ne peut pas être supprimé." -#: machines/views.py:1176 +#: machines/views.py:1190 msgid "The VLAN was created." msgstr "Le VLAN a été créé." -#: machines/views.py:1193 +#: machines/views.py:1207 msgid "The VLAN was edited." msgstr "Le VLAN a été modifié." -#: machines/views.py:1210 +#: machines/views.py:1224 msgid "The VLAN was deleted." msgstr "Le VLAN a été supprimé." -#: machines/views.py:1213 +#: machines/views.py:1227 #, python-format msgid "Error: the VLAN %s can't be deleted." msgstr "Erreur : le VLAN %s ne peut pas être supprimé." -#: machines/views.py:1228 +#: machines/views.py:1242 msgid "The NAS device was created." msgstr "Le dispositif NAS a été créé." -#: machines/views.py:1245 +#: machines/views.py:1259 msgid "The NAS device was edited." msgstr "Le dispositif NAS a été modifié." -#: machines/views.py:1262 +#: machines/views.py:1276 msgid "The NAS device was deleted." msgstr "Le dispositif NAS a été supprimé." -#: machines/views.py:1265 +#: machines/views.py:1279 #, python-format msgid "Error: the NAS device %s can't be deleted." msgstr "Erreur : le dispositif NAS %s ne peut pas être supprimé." -#: machines/views.py:1491 +#: machines/views.py:1506 msgid "The ports list was edited." msgstr "La liste de ports a été modifiée." -#: machines/views.py:1505 +#: machines/views.py:1520 msgid "The ports list was deleted." msgstr "La liste de ports a été supprimée." -#: machines/views.py:1530 +#: machines/views.py:1545 msgid "The ports list was created." msgstr "La liste de ports a été créée." -#: machines/views.py:1550 +#: machines/views.py:1566 msgid "" "Warning: the IP address is not public, the opening won't have any effect in " "v4." @@ -1797,7 +1805,7 @@ msgstr "" "Attention : l'adresse IP n'est pas publique, l'ouverture n'aura pas d'effet " "en v4." -#: machines/views.py:1561 +#: machines/views.py:1577 msgid "The ports configuration was edited." msgstr "La configuration de ports a été modifiée." diff --git a/machines/models.py b/machines/models.py index 0eb7e49d..3568e83b 100644 --- a/machines/models.py +++ b/machines/models.py @@ -353,9 +353,6 @@ class MachineType(RevMixin, AclMixin, models.Model): """Get all interfaces of the current machine type (self).""" return Interface.objects.filter(machine_type=self) - def save(self, *args, **kwargs): - super(MachineType, self).save(*args, **kwargs) - @staticmethod def can_use_all(user_request, *_args, **_kwargs): """Check if an user can use all machine types. From f91dcf82c426c2fd6782618ab4c2426b3580050a Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 23:23:48 +0200 Subject: [PATCH 5/6] Refactoring --- machines/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/machines/models.py b/machines/models.py index 3568e83b..09131412 100644 --- a/machines/models.py +++ b/machines/models.py @@ -353,6 +353,9 @@ class MachineType(RevMixin, AclMixin, models.Model): """Get all interfaces of the current machine type (self).""" return Interface.objects.filter(machine_type=self) + def update_domains(self): + Domain.objects.filter(interface_parent__machine_type=self).update(extension=self.ip_type.extension) + @staticmethod def can_use_all(user_request, *_args, **_kwargs): """Check if an user can use all machine types. @@ -2479,7 +2482,7 @@ def machinetype_post_save(**kwargs): parent IP type). """ machinetype = kwargs["instance"] - Domain.objects.filter(interface_parent__machine_type=machinetype).update(extension=machinetype.ip_type.extension) + machinetype.update_domains() @receiver(post_save, sender=Domain) From 31c3441cfcd8bea3397a0ca0fa3d971db7c6acd5 Mon Sep 17 00:00:00 2001 From: chapeau Date: Tue, 9 Jun 2020 23:30:52 +0200 Subject: [PATCH 6/6] Update models.py --- machines/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/machines/models.py b/machines/models.py index 09131412..734f8330 100644 --- a/machines/models.py +++ b/machines/models.py @@ -354,6 +354,9 @@ class MachineType(RevMixin, AclMixin, models.Model): return Interface.objects.filter(machine_type=self) def update_domains(self): + """Update domains extension with the extension of interface_parent. Called after update of an ip_type or a machine_type object. Exceptions are handled in the views. + (Calling domain.clear() for all domains could take several minutes) + """ Domain.objects.filter(interface_parent__machine_type=self).update(extension=self.ip_type.extension) @staticmethod