Verified Commit c989130f authored by erdnaxe's avatar erdnaxe 🎇

Move SOA to admin and update translations

parent 54392d96
Pipeline #1105 passed with stage
in 3 minutes and 2 seconds
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2019-01-07 01:37+0100\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-03-31 16:09+0002\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language: fr_FR\n"
......
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-06-23 16:01+0200\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......
......@@ -18,6 +18,7 @@ from reversion.admin import VersionAdmin
from .models import (
MachineType,
Nas,
SOA,
Vlan,
)
......@@ -36,6 +37,12 @@ class NasAdmin(VersionAdmin):
list_filter = ('port_access_mode', 'autocapture_mac')
@admin.register(SOA)
class SOAAdmin(VersionAdmin):
"""Admin view of a SOA object"""
list_display = ('name', 'mail', 'refresh', 'retry', 'expire', 'ttl')
@admin.register(Vlan)
class VlanAdmin(VersionAdmin):
"""Admin view of a VLAN object"""
......
......@@ -257,35 +257,6 @@ class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
super(Ipv6ListForm, self).__init__(*args, prefix=prefix, **kwargs)
class SOAForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un SOA"""
class Meta:
model = SOA
fields = '__all__'
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(SOAForm, self).__init__(*args, prefix=prefix, **kwargs)
class DelSOAForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs SOA"""
soa = forms.ModelMultipleChoiceField(
queryset=SOA.objects.none(),
label=_("Current SOA records"),
widget=forms.CheckboxSelectMultiple
)
def __init__(self, *args, **kwargs):
instances = kwargs.pop('instances', None)
super(DelSOAForm, self).__init__(*args, **kwargs)
if instances:
self.fields['soa'].queryset = instances
else:
self.fields['soa'].queryset = SOA.objects.all()
class MxForm(FormRevMixin, ModelForm):
"""Ajout et edition d'un MX"""
......
This diff is collapsed.
......@@ -628,28 +628,35 @@ class SOA(RevMixin, AclMixin, models.Model):
Les valeurs par défault viennent des recommandations RIPE :
https://www.ripe.net/publications/docs/ripe-203
"""
name = models.CharField(max_length=255)
name = models.CharField(
verbose_name=_('name'),
max_length=255,
)
mail = models.EmailField(
help_text=_("Contact email address for the zone")
verbose_name=_('mail'),
help_text=_("Contact email address for this zone."),
)
refresh = models.PositiveIntegerField(
default=86400, # 24 hours
verbose_name=_('refresh'),
help_text=_("Seconds before the secondary DNS have to ask the primary"
" DNS serial to detect a modification")
" DNS serial to detect a modification."),
)
retry = models.PositiveIntegerField(
default=7200, # 2 hours
verbose_name=_('retry'),
help_text=_("Seconds before the secondary DNS ask the serial again in"
" case of a primary DNS timeout")
" case of a primary DNS timeout."),
)
expire = models.PositiveIntegerField(
default=3600000, # 1000 hours
verbose_name=_('expire'),
help_text=_("Seconds before the secondary DNS stop answering requests"
" in case of primary DNS timeout")
" in case of primary DNS timeout."),
)
ttl = models.PositiveIntegerField(
default=172800, # 2 days
help_text=_("Time to Live")
verbose_name=_('time to live'),
)
class Meta:
......
......@@ -41,17 +41,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a>
{% include 'machines/aff_extension.html' with extension_list=extension_list %}
<h2>{% trans "List of SOA records" %}</h2>
{% can_create SOA %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-soa' %}">
<i class="fa fa-plus"></i>{% trans " Add an SOA record" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-soa' %}">
<i class="fa fa-trash"></i>{% trans " Delete one or several SOA records" %}
</a>
{% include 'machines/aff_soa.html' with soa_list=soa_list %}
<h2>{% trans "List of MX records" %}</h2>
{% can_create Mx %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-mx' %}">
......
......@@ -42,9 +42,6 @@ urlpatterns = [
views.edit_extension,
name='edit-extension'),
url(r'^del_extension/$', views.del_extension, name='del-extension'),
url(r'^add_soa/$', views.add_soa, name='add-soa'),
url(r'^edit_soa/(?P<soaid>[0-9]+)$', views.edit_soa, name='edit-soa'),
url(r'^del_soa/$', views.del_soa, name='del-soa'),
url(r'^add_mx/$', views.add_mx, name='add-mx'),
url(r'^edit_mx/(?P<mxid>[0-9]+)$', views.edit_mx, name='edit-mx'),
url(r'^del_mx/$', views.del_mx, name='del-mx'),
......
......@@ -56,8 +56,6 @@ from .forms import (
DomainForm,
AliasForm,
DelAliasForm,
SOAForm,
DelSOAForm,
NsForm,
DelNsForm,
TxtForm,
......@@ -628,63 +626,6 @@ def del_extension(request, instances):
)
@login_required
@can_create(SOA)
def add_soa(request):
""" View used to add a SOA object """
soa = SOAForm(request.POST or None)
if soa.is_valid():
soa.save()
messages.success(request, _("The SOA record was created."))
return redirect(reverse('machines:index-extension'))
return form(
{'soaform': soa, 'action_name': _("Create an SOA record")},
'machines/machine.html',
request
)
@login_required
@can_edit(SOA)
def edit_soa(request, soa_instance, **_kwargs):
""" View used to edit a SOA object """
soa = SOAForm(request.POST or None, instance=soa_instance)
if soa.is_valid():
if soa.changed_data:
soa.save()
messages.success(request, _("The SOA record was edited."))
return redirect(reverse('machines:index-extension'))
return form(
{'soaform': soa, 'action_name': _("Edit")},
'machines/machine.html',
request
)
@login_required
@can_delete_set(SOA)
def del_soa(request, instances):
""" View used to delete a SOA object """
soa = DelSOAForm(request.POST or None, instances=instances)
if soa.is_valid():
soa_dels = soa.cleaned_data['soa']
for soa_del in soa_dels:
try:
soa_del.delete()
messages.success(request, _("The SOA record was deleted."))
except ProtectedError:
messages.error(
request,
(_("Error: the SOA record %s can't be deleted.") % soa_del)
)
return redirect(reverse('machines:index-extension'))
return form(
{'soaform': soa, 'action_name': _("Delete")},
'machines/machine.html',
request
)
@login_required
@can_create(Mx)
def add_mx(request):
......
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-06-24 15:54+0200\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-03-31 16:09+0002\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......@@ -249,11 +249,7 @@ msgstr "Tweets de @%(twitter_account_name)s"
msgid "Follow @%(twitter_account_name)s"
msgstr "Suivre @%(twitter_account_name)s"
#: re2o/urls.py:19 re2o/urls.py:20
msgid "Aube"
msgstr ""
#: re2o/urls.py:21
#: re2o/urls.py:19
msgid "Homepage"
msgstr "Accueil"
......
......@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-06-24 20:10+0200\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......
......@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-11 16:09+0200\n"
"POT-Creation-Date: 2019-04-12 14:48+0200\n"
"PO-Revision-Date: 2018-03-31 16:09+0002\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
......@@ -57,11 +57,11 @@ msgid ""
"\">this form</a>."
msgstr ""
#: templates/admin/base_site.html:63 templates/base.html:268
#: templates/admin/base_site.html:63 templates/base.html:275
msgid "powered by"
msgstr "propulsé par"
#: templates/admin/base_site.html:65 templates/base.html:276
#: templates/admin/base_site.html:65 templates/base.html:283
msgid ""
"This software is under the terms of the <a href=\"http://www.gnu.org/"
"licenses/gpl-2.0.txt\" target=\"_blank\" rel=\"nofollow\">GPLv2</a> License."
......@@ -73,7 +73,13 @@ msgstr ""
msgid "Networking managing website endorsed by FedeRez."
msgstr "Site de gestion de réseau soutenu par FedeRez."
#: templates/base.html:70
#: templates/base.html:70 templates/registration/logged_out.html:11
#: templates/registration/password_change_done.html:11
#: templates/registration/password_change_form.html:11
#: templates/registration/password_reset_complete.html:11
#: templates/registration/password_reset_confirm.html:11
#: templates/registration/password_reset_done.html:11
#: templates/registration/password_reset_form.html:11
msgid "Home"
msgstr "Accueil"
......@@ -114,100 +120,104 @@ msgid "Administration"
msgstr "Administration"
#: templates/base.html:127
msgid "Manage"
msgstr ""
#: templates/base.html:134
msgid "More information"
msgstr "Plus d'informations"
#: templates/base.html:129
#: templates/base.html:136
msgid "About"
msgstr "À propos"
#: templates/base.html:130
#: templates/base.html:137
msgid "Contact"
msgstr "Contact"
#: templates/base.html:137 templates/index.html:31
#: templates/base.html:144 templates/index.html:31
msgid "Sign up"
msgstr "S'inscrire"
#: templates/base.html:143 templates/index.html:38
#: templates/registration/login.html:29 templates/registration/login.html:45
#: templates/base.html:150 templates/index.html:38
#: templates/registration/login.html:11 templates/registration/login.html:57
msgid "Log in"
msgstr "Se connecter"
#: templates/base.html:151
#: templates/base.html:158
msgid "Search"
msgstr "Rechercher"
#: templates/base.html:165 templates/index.html:41
#: templates/base.html:172 templates/index.html:41
msgid "My profile"
msgstr "Mon profil"
#: templates/base.html:166
#: templates/base.html:173
msgid "Log out"
msgstr "Se déconnecter"
#: templates/base.html:201
#: templates/base.html:208
msgid "Username"
msgstr "Pseudo"
#: templates/base.html:205
#: templates/base.html:212
msgid "Room"
msgstr "Chambre"
#: templates/base.html:209
#: templates/base.html:216
msgid "Internet access"
msgstr "Accès Internet"
#: templates/base.html:212
#: templates/base.html:219
#, python-format
msgid "Until %(end_access_date)s"
msgstr "Jusqu'au %(end_access_date)s"
#: templates/base.html:214
#: templates/base.html:221
msgid "Disabled"
msgstr "Désactivé"
#: templates/base.html:219
#: templates/base.html:226
msgid "Membership"
msgstr "Adhésion"
#: templates/base.html:222
#: templates/base.html:229
#, python-format
msgid "Until %(end_adhesion_date)s"
msgstr "Jusqu'au %(end_adhesion_date)s"
#: templates/base.html:224
#: templates/base.html:231
msgid "Non member"
msgstr "Non adhérent"
#: templates/base.html:232
#: templates/base.html:239
msgid "View my profile"
msgstr "Voir mon profil"
#: templates/base.html:237
#: templates/base.html:244
msgid "You are not logged in."
msgstr "Vous n'êtes pas connecté."
#: templates/base.html:244
#: templates/base.html:251
#, python-format
msgid "%(nb)s active machine"
msgid_plural "%(nb)s active machines"
msgstr[0] "%(nb)s machine active"
msgstr[1] "%(nb)s machines actives"
#: templates/base.html:253
#: templates/base.html:260
msgid "View my machines"
msgstr "Voir mes machines"
#: templates/base.html:266
#: templates/base.html:273
msgid "Back to top"
msgstr "Retour en haut"
#: templates/base.html:270
#: templates/base.html:277
msgid "Brought to you with <i class=\"fa fa-heart text-danger\"></i>."
msgstr "Codé avec <i class=\"fa fa-heart text-danger\"></i>."
#: templates/base.html:273
#: templates/base.html:280
msgid "About this website"
msgstr "À propos de ce site"
......@@ -393,13 +403,68 @@ msgstr "Suivant"
msgid "Last"
msgstr "Dernière page"
#: templates/registration/login.html:34
#: templates/registration/logged_out.html:16
msgid "Thanks for spending some quality time with the Web site today."
msgstr ""
#: templates/registration/logged_out.html:17
msgid "Log in again"
msgstr ""
#: templates/registration/login.html:16
msgid "Please correct the error below."
msgstr ""
#: templates/registration/login.html:17
msgid "Please correct the errors below."
msgstr ""
#: templates/registration/login.html:33
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""
#: templates/registration/login.html:49
msgid "Forgotten password?"
msgstr "Mot de passe oublié ?"
#: templates/registration/login.html:53
msgid "Forgotten your password or username?"
msgstr ""
#: templates/registration/password_change_done.html:11
#: templates/registration/password_change_form.html:11
msgid "Password change"
msgstr ""
#: templates/registration/password_reset_complete.html:11
#: templates/registration/password_reset_done.html:11
#: templates/registration/password_reset_form.html:11
msgid "Password reset"
msgstr ""
#: templates/registration/password_reset_confirm.html:11
msgid "Password reset confirmation"
msgstr ""
#: templates/registration/password_reset_email.html:2
#, python-format
msgid ""
"You're receiving this email because you requested a password reset for your "
"user account at %(site_name)s."
msgstr ""
#: templates/registration/password_reset_email.html:4
msgid "Please go to the following page and choose a new password:"
msgstr ""
#: templates/registration/password_reset_email.html:8
msgid "Your username, in case you've forgotten:"
msgstr ""
#: templates/registration/password_reset_email.html:10
msgid "Thanks for using our site!"
msgstr ""
#: templates/registration/password_reset_email.html:12
#, python-format
msgid "The %(site_name)s team"
msgstr ""
This diff is collapsed.
This diff is collapsed.
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