From a31f0b0785a0f3ad4212dd2f067f6c5950ab9304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Wed, 11 Oct 2017 21:33:21 +0000 Subject: [PATCH] Renome enregistrement Text en enregistrement Txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parce que ça s'appelle comme ça Faudra aussi bouger dans la bdd mais là c'est plus délicat (migrations) --- machines/forms.py | 8 ++-- .../machines/{aff_text.html => aff_txt.html} | 16 +++---- .../templates/machines/index_extension.html | 8 ++-- machines/urls.py | 8 ++-- machines/views.py | 44 +++++++++---------- 5 files changed, 42 insertions(+), 42 deletions(-) rename machines/templates/machines/{aff_text.html => aff_txt.html} (84%) diff --git a/machines/forms.py b/machines/forms.py index 7ff85695..6112a182 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -210,17 +210,17 @@ class NsForm(ModelForm): class DelNsForm(Form): ns = forms.ModelMultipleChoiceField(queryset=Ns.objects.all(), label="Enregistrements NS actuels", widget=forms.CheckboxSelectMultiple) -class TextForm(ModelForm): +class TxtForm(ModelForm): class Meta: model = Text fields = '__all__' def __init__(self, *args, **kwargs): prefix = kwargs.pop('prefix', self.Meta.model.__name__) - super(TextForm, self).__init__(*args, prefix=prefix, **kwargs) + super(TxtForm, self).__init__(*args, prefix=prefix, **kwargs) -class DelTextForm(Form): - text = forms.ModelMultipleChoiceField(queryset=Text.objects.all(), label="Enregistrements Text actuels", widget=forms.CheckboxSelectMultiple) +class DelTxtForm(Form): + txt = forms.ModelMultipleChoiceField(queryset=Text.objects.all(), label="Enregistrements Txt actuels", widget=forms.CheckboxSelectMultiple) class NasForm(ModelForm): class Meta: diff --git a/machines/templates/machines/aff_text.html b/machines/templates/machines/aff_txt.html similarity index 84% rename from machines/templates/machines/aff_text.html rename to machines/templates/machines/aff_txt.html index f3ada132..fd7c5ee6 100644 --- a/machines/templates/machines/aff_text.html +++ b/machines/templates/machines/aff_txt.html @@ -25,21 +25,21 @@ with this program; if not, write to the Free Software Foundation, Inc., - - - + + + - {% for text in text_list %} + {% for txt in txt_list %} - - + + {% endfor %} diff --git a/machines/templates/machines/index_extension.html b/machines/templates/machines/index_extension.html index 20587d85..88eb5411 100644 --- a/machines/templates/machines/index_extension.html +++ b/machines/templates/machines/index_extension.html @@ -47,12 +47,12 @@ with this program; if not, write to the Free Software Foundation, Inc., Supprimer un enregistrement NS {% endif %} {% include "machines/aff_ns.html" with ns_list=ns_list %} -

Liste des enregistrements Text

+

Liste des enregistrements TXT

{% if is_infra %} - Ajouter un enregistrement TXT - Supprimer un enregistrement TXT + Ajouter un enregistrement TXT + Supprimer un enregistrement TXT {% endif %} - {% include "machines/aff_text.html" with text_list=text_list %} + {% include "machines/aff_txt.html" with txt_list=txt_list %}


diff --git a/machines/urls.py b/machines/urls.py index 886c7c0a..1ce5db7d 100644 --- a/machines/urls.py +++ b/machines/urls.py @@ -47,9 +47,9 @@ urlpatterns = [ url(r'^add_mx/$', views.add_mx, name='add-mx'), url(r'^edit_mx/(?P[0-9]+)$', views.edit_mx, name='edit-mx'), url(r'^del_mx/$', views.del_mx, name='del-mx'), - url(r'^add_text/$', views.add_text, name='add-text'), - url(r'^edit_text/(?P[0-9]+)$', views.edit_text, name='edit-text'), - url(r'^del_text/$', views.del_text, name='del-text'), + url(r'^add_txt/$', views.add_txt, name='add-txt'), + url(r'^edit_txt/(?P[0-9]+)$', views.edit_txt, name='edit-txt'), + url(r'^del_txt/$', views.del_txt, name='del-txt'), url(r'^add_ns/$', views.add_ns, name='add-ns'), url(r'^edit_ns/(?P[0-9]+)$', views.edit_ns, name='edit-ns'), url(r'^del_ns/$', views.del_ns, name='del-ns'), @@ -76,7 +76,7 @@ urlpatterns = [ url(r'^history/(?Pextension)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Pmx)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Pns)/(?P[0-9]+)$', views.history, name='history'), - url(r'^history/(?Ptext)/(?P[0-9]+)$', views.history, name='history'), + url(r'^history/(?Ptxt)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Piptype)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Palias)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Pvlan)/(?P[0-9]+)$', views.history, name='history'), diff --git a/machines/views.py b/machines/views.py index a0bc92cf..06843a76 100644 --- a/machines/views.py +++ b/machines/views.py @@ -49,7 +49,7 @@ from reversion.models import Version import re from .forms import NewMachineForm, EditMachineForm, EditInterfaceForm, AddInterfaceForm, MachineTypeForm, DelMachineTypeForm, ExtensionForm, DelExtensionForm, BaseEditInterfaceForm, BaseEditMachineForm -from .forms import EditIpTypeForm, IpTypeForm, DelIpTypeForm, DomainForm, AliasForm, DelAliasForm, NsForm, DelNsForm, TextForm, DelTextForm, MxForm, DelMxForm, VlanForm, DelVlanForm, ServiceForm, DelServiceForm, NasForm, DelNasForm +from .forms import EditIpTypeForm, IpTypeForm, DelIpTypeForm, DomainForm, AliasForm, DelAliasForm, NsForm, DelNsForm, TxtForm, DelTxtForm, MxForm, DelMxForm, VlanForm, DelVlanForm, ServiceForm, DelServiceForm, NasForm, DelNasForm from .forms import EditOuverturePortListForm, EditOuverturePortConfigForm from .models import IpType, Machine, Interface, IpList, MachineType, Extension, Mx, Ns, Domain, Service, Service_link, Vlan, Nas, Text, OuverturePortList, OuverturePort from users.models import User @@ -573,11 +573,11 @@ def del_ns(request): @login_required @permission_required('infra') -def add_text(request): - text = TextForm(request.POST or None) - if text.is_valid(): +def add_txt(request): + txt = TxtForm(request.POST or None) + if txt.is_valid(): with transaction.atomic(), reversion.create_revision(): - text.save() + txt.save() reversion.set_user(request.user) reversion.set_comment("Création") messages.success(request, "Cet enregistrement text a été ajouté") @@ -586,36 +586,36 @@ def add_text(request): @login_required @permission_required('infra') -def edit_text(request, textid): +def edit_txt(request, txtid): try: - text_instance = Text.objects.get(pk=textid) + txt_instance = Text.objects.get(pk=txtid) except Text.DoesNotExist: messages.error(request, u"Entrée inexistante" ) return redirect("/machines/index_extension/") - text = TextForm(request.POST or None, instance=text_instance) - if text.is_valid(): + txt = TxtForm(request.POST or None, instance=txt_instance) + if txt.is_valid(): with transaction.atomic(), reversion.create_revision(): - text.save() + txt.save() reversion.set_user(request.user) - reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in text.changed_data)) - messages.success(request, "Text modifié") + reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in txt.changed_data)) + messages.success(request, "Txt modifié") return redirect("/machines/index_extension/") return form({'machineform': text}, 'machines/machine.html', request) @login_required @permission_required('infra') -def del_text(request): - text = DelTextForm(request.POST or None) - if text.is_valid(): - text_dels = text.cleaned_data['text'] - for text_del in text_dels: +def del_txt(request): + txt = DelTxtForm(request.POST or None) + if txt.is_valid(): + txt_dels = txt.cleaned_data['txt'] + for txt_del in txt_dels: try: with transaction.atomic(), reversion.create_revision(): - text_del.delete() + txt_del.delete() reversion.set_user(request.user) - messages.success(request, "Le text a été supprimé") + messages.success(request, "Le txt a été supprimé") except ProtectedError: - messages.error(request, "Erreur le Text suivant %s ne peut être supprimé" % text_del) + messages.error(request, "Erreur le Txt suivant %s ne peut être supprimé" % txt_del) return redirect("/machines/index_extension") return form({'machineform': text, 'interfaceform': None}, 'machines/machine.html', request) @@ -960,11 +960,11 @@ def history(request, object, id): except Mx.DoesNotExist: messages.error(request, "Mx inexistant") return redirect("/machines/") - elif object == 'text' and request.user.has_perms(('cableur',)): + elif object == 'txt' and request.user.has_perms(('cableur',)): try: object_instance = Text.objects.get(pk=id) except Text.DoesNotExist: - messages.error(request, "Text inexistant") + messages.error(request, "Txt inexistant") return redirect("/machines/") elif object == 'ns' and request.user.has_perms(('cableur',)): try:
Zone concernéeEnregistrementZone concernéeEnregistrement
{{ text.zone }}{{ text.dns_entry }}{{ txt.zone }}{{ txt.dns_entry }} {% if is_infra %} - {% include 'buttons/edit.html' with href='machines:edit-text' id=text.id %} + {% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %} {% endif %} - {% include 'buttons/history.html' with href='machines:history' name='text' id=text.id %} + {% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %}