8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

translation and cleanup

This commit is contained in:
Maël Kervella 2018-07-23 23:33:01 +00:00
parent 352a416647
commit 5dce3629b7
13 changed files with 110 additions and 169 deletions

View file

@ -600,7 +600,7 @@ class EditOuverturePortListForm(FormRevMixin, ModelForm):
class SshFingerprintForm(FormRevMixin, ModelForm): class SshFingerprintForm(FormRevMixin, ModelForm):
"""Edition d'une sshfingerprint""" """Edits a SSH fingerprint."""
class Meta: class Meta:
model = SshFingerprint model = SshFingerprint
exclude = ('machine',) exclude = ('machine',)
@ -615,7 +615,7 @@ class SshFingerprintForm(FormRevMixin, ModelForm):
class SshFprAlgoForm(FormRevMixin, ModelForm): class SshFprAlgoForm(FormRevMixin, ModelForm):
"""Edition de la liste des algo pour sshfpr""" """Edits a SSH fingerprint algorithm."""
class Meta: class Meta:
model = SshFprAlgo model = SshFprAlgo
fields = '__all__' fields = '__all__'

View file

@ -10,7 +10,7 @@ import re2o.mixins
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('machines', '0083_role'), ('machines', '0083_remove_duplicate_rights'),
] ]
operations = [ operations = [
@ -18,11 +18,15 @@ class Migration(migrations.Migration):
name='SshFingerprint', name='SshFingerprint',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hash_entry', models.TextField(max_length=512)), ('pub_key_entry', models.TextField(help_text='SSH public key', max_length=2048)),
('comment', models.CharField(blank=True, max_length=255, null=True)), ('comment', models.CharField(blank=True, help_text='Comment', max_length=255, null=True)),
('algo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.SshFprAlgo')),
('machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Machine')),
], ],
options={ options={
'permissions': (('view_sshfingerprint', 'Peut voir un objet sshfingerprint'),), 'permissions': (('view_sshfingerprint', 'Can see an SSH fingerprint'),),
'verbose_name': 'SSH fingerprint',
'verbose_name_plural': 'SSH fingerprints'
}, },
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model), bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model),
), ),
@ -30,21 +34,13 @@ class Migration(migrations.Migration):
name='SshFprAlgo', name='SshFprAlgo',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.TextField(max_length=256)), ('name', models.CharField(max_length=256)),
], ],
options={ options={
'permissions': (('view_sshfpralgo', 'Peut voir un algo de chiffrement'),), 'permissions': (('view_sshfpralgo', 'Can see an SSH fingerprint algorithm'),),
'verbose_name': 'SSH fingerprint algorithm',
'verbose_name_plural': 'SSH fingerprint algorithms'
}, },
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model), bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model),
), ),
migrations.AddField(
model_name='sshfingerprint',
name='algo',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.SshFprAlgo'),
),
migrations.AddField(
model_name='sshfingerprint',
name='machine',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Machine'),
),
] ]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-06-23 16:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('machines', '0084_auto_20180623_1651'),
]
operations = [
migrations.AlterField(
model_name='sshfpralgo',
name='name',
field=models.CharField(max_length=256),
),
]

View file

@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-06-24 10:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('machines', '0085_auto_20180623_1817'),
]
operations = [
migrations.RenameField(
model_name='sshfingerprint',
old_name='hash_entry',
new_name='pub_key_entry',
),
migrations.AlterField(
model_name='sshfingerprint',
name='comment',
field=models.CharField(blank=True, help_text='Commentaire', max_length=255, null=True),
),
migrations.AlterField(
model_name='sshfingerprint',
name='pub_key_entry',
field=models.TextField(help_text='Clef publique ssh', max_length=2048),
),
]

View file

@ -201,14 +201,10 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
return str(self.user) + ' - ' + str(self.id) + ' - ' + str(self.name) return str(self.user) + ' - ' + str(self.id) + ' - ' + str(self.name)
class SshFingerprint(RevMixin, AclMixin, models.Model): class SshFingerprint(RevMixin, AclMixin, models.Model):
"""Stockage de la clef ssh publique d'une machine """A fingerpirnt of an SSH public key"""
et calcul de ses hash"""
PRETTY_NAME = "Clef publique ssh"
machine = models.ForeignKey('Machine', on_delete=models.CASCADE) machine = models.ForeignKey('Machine', on_delete=models.CASCADE)
pub_key_entry = models.TextField( pub_key_entry = models.TextField(
help_text="Clef publique ssh", help_text="SSH public key",
max_length=2048 max_length=2048
) )
algo = models.ForeignKey( algo = models.ForeignKey(
@ -216,7 +212,7 @@ class SshFingerprint(RevMixin, AclMixin, models.Model):
on_delete=models.PROTECT on_delete=models.PROTECT
) )
comment = models.CharField( comment = models.CharField(
help_text="Commentaire", help_text="Comment",
max_length=255, max_length=255,
null=True, null=True,
blank=True blank=True
@ -224,8 +220,10 @@ class SshFingerprint(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_sshfingerprint", "Peut voir un objet sshfingerprint"), ("view_sshfingerprint", "Can see an SSH fingerprint"),
) )
verbose_name = "SSH fingerprint"
verbose_name_plural = "SSH fingerprints"
def can_view(self, user_request, *_args, **_kwargs): def can_view(self, user_request, *_args, **_kwargs):
return self.machine.can_view(user_request, *_args, **_kwargs) return self.machine.can_view(user_request, *_args, **_kwargs)
@ -241,15 +239,15 @@ class SshFingerprint(RevMixin, AclMixin, models.Model):
class SshFprAlgo(RevMixin, AclMixin, models.Model): class SshFprAlgo(RevMixin, AclMixin, models.Model):
"""Un aglorithme de création de la fingerprint ssh""" """An algorithm to compute SSH fingerprints"""
PRETTY_NAME = "Algo de clef ssh"
name = models.CharField(max_length=256) name = models.CharField(max_length=256)
class Meta: class Meta:
permissions = ( permissions = (
("view_sshfpralgo", "Peut voir un algo de chiffrement"), ("view_sshfpralgo", "Can see an SSH fingerprint algorithm"),
) )
verbose_name = "SSH fingerprint algorithm"
verbose_name_plural = "SSH fingerprint algorithms"
def __str__(self): def __str__(self):
return str(self.name) return str(self.name)

View file

@ -122,7 +122,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_create SshFingerprint interface.machine.id %} {% can_create SshFingerprint interface.machine.id %}
<li> <li>
<a href="{% url 'machines:index-sshfingerprint' interface.machine.id %}"> <a href="{% url 'machines:index-sshfingerprint' interface.machine.id %}">
<i class="fa fa-edit"></i> Gerer les fingerprint ssh <i class="fa fa-edit"></i> Manage the SSH fingerprints
</a> </a>
</li> </li>
{% acl_end %} {% acl_end %}

View file

@ -21,14 +21,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped long_text"> <table class="table table-striped long_text">
<thead> <thead>
<tr> <tr>
<th class="long_text">Entrée du hash</th> <th class="long_text">SSH public key</th>
<th>Algorithme utilisé</th> <th>Algorithm used</th>
<th>Commentaire</th> <th>Comment</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
{% for sshfpr in sshfingerprint_list %} {% for sshfpr in sshfingerprint_list %}
@ -36,14 +38,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td class="long_text">{{ sshfpr.pub_key_entry }}</td> <td class="long_text">{{ sshfpr.pub_key_entry }}</td>
<td>{{ sshfpr.algo }}</td> <td>{{ sshfpr.algo }}</td>
<td>{{ sshfpr.comment }}</td> <td>{{ sshfpr.comment }}</td>
<td class="text-right"> <td class="text-right">
{% can_edit sshfpr %} {% can_edit sshfpr %}
{% include 'buttons/edit.html' with href='machines:edit-sshfingerprint' id=sshfpr.id %} {% include 'buttons/edit.html' with href='machines:edit-sshfingerprint' id=sshfpr.id %}
{% acl_end %} {% acl_end %}
{% can_delete sshfpr %} {% can_delete sshfpr %}
{% include 'buttons/suppr.html' with href='machines:del-sshfingerprint' id=sshfpr.id %} {% include 'buttons/suppr.html' with href='machines:del-sshfingerprint' id=sshfpr.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='sshfingerprint' id=sshfpr.id %} {% history_button sshfpr %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -21,27 +21,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>Nom de l'algo</th>
<th></th>
</tr>
</thead>
{% for sshfpralgo in sshfpralgo_list %}
<tr> <tr>
<td>{{ sshfpralgo.name }}</td> <th>Algorithm name</th>
<td class="text-right"> <th></th>
{% can_edit sshfpralgo %}
{% include 'buttons/edit.html' with href='machines:edit-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% can_delete sshfpralgo %}
{% include 'buttons/suppr.html' with href='machines:del-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='sshfpralgo' id=sshfpralgo.id %}
</td>
</tr> </tr>
{% endfor %} </thead>
</table> {% for sshfpralgo in sshfpralgo_list %}
<tr>
<td>{{ sshfpralgo.name }}</td>
<td class="text-right">
{% can_edit sshfpralgo %}
{% include 'buttons/edit.html' with href='machines:edit-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% can_delete sshfpralgo %}
{% include 'buttons/suppr.html' with href='machines:del-sshfpralgo' id=sshfpralgo.id %}
{% acl_end %}
{% history_button sshfpralgo %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -27,13 +27,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Machines{% endblock %} {% block title %}Machines{% endblock %}
{% block content %} {% block content %}
<h2>Liste des fingerprint ssh</h2> <h2>SSH fingerprints</h2>
{% can_create SshFingerprint machine_id %} {% can_create SshFingerprint machine_id %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-sshfingerprint' machine_id %}"><i class="fa fa-plus"></i> Ajouter une fingerprint ssh</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-sshfingerprint' machine_id %}">
{% acl_end %} <i class="fa fa-plus"></i> Add an SSH fingerprint
{% include "machines/aff_sshfingerprint.html" with sshfingerprint_list=sshfingerprint_list %} </a>
<br /> {% acl_end %}
<br /> {% include "machines/aff_sshfingerprint.html" with sshfingerprint_list=sshfingerprint_list %}
<br />
{% endblock %} {% endblock %}

View file

@ -27,13 +27,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Machines{% endblock %} {% block title %}Machines{% endblock %}
{% block content %} {% block content %}
<h2>Liste des algo fingerprint ssh</h2> <h2>SSH fingerprint algorithms</h2>
{% can_create SshFprAlgo %} {% can_create SshFprAlgo %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-sshfpralgo' %}"><i class="fa fa-plus"></i> Ajouter un algo ssh</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-sshfpralgo' %}">
{% acl_end %} <i class="fa fa-plus"></i> Add an SSH fingerprint algorithm
{% include "machines/aff_sshfpralgo.html" with sshfpralgo_list=sshfpralgo_list %} </a>
<br /> {% acl_end %}
<br /> {% include "machines/aff_sshfpralgo.html" with sshfpralgo_list=sshfpralgo_list %}
<br />
{% endblock %} {% endblock %}

View file

@ -33,6 +33,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if machineform %} {% if machineform %}
{% bootstrap_form_errors machineform %} {% bootstrap_form_errors machineform %}
{% endif %} {% endif %}
{% if sshfingerprintform %}
{% bootstrap_form_errors sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
{% bootstrap_form_errors sshfpralgoform %}
{% endif %}
{% if interfaceform %} {% if interfaceform %}
{% bootstrap_form_errors interfaceform %} {% bootstrap_form_errors interfaceform %}
{% endif %} {% endif %}
@ -78,15 +84,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if ipv6form %} {% if ipv6form %}
{% bootstrap_form_errors ipv6form %} {% bootstrap_form_errors ipv6form %}
{% endif %} {% endif %}
{% if sshfingerprintform %}
{% bootstrap_form_errors sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
{% bootstrap_form_errors sshfpralgoform %}
{% endif %}
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}
@ -94,6 +91,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h3>Machine</h3> <h3>Machine</h3>
{% massive_bootstrap_form machineform 'user' %} {% massive_bootstrap_form machineform 'user' %}
{% endif %} {% endif %}
{% if sshfingerprintform %}
<h3>SSH fingerprint</h3>
{% bootstrap_form sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
<h3>SSH fingerprint algorithm</h3>
{% bootstrap_form sshfpralgoform %}
{% endif %}
{% if interfaceform %} {% if interfaceform %}
<h3>Interface</h3> <h3>Interface</h3>
{% if i_mbf_param %} {% if i_mbf_param %}
@ -162,14 +167,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h3>Ipv6</h3> <h3>Ipv6</h3>
{% bootstrap_form ipv6form %} {% bootstrap_form ipv6form %}
{% endif %} {% endif %}
{% if sshfingerprintform %}
<h3>SshFingerprint</h3>
{% bootstrap_form sshfingerprintform %}
{% endif %}
{% if sshfpralgoform %}
<h3>Algorithme de fingerprint ssh</h3>
{% bootstrap_form sshfpralgoform %}
{% endif %}
{% bootstrap_button action_name button_type="submit" icon="star" %} {% bootstrap_button action_name button_type="submit" icon="star" %}
</form> </form>
<br /> <br />

View file

@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_view_all SshFprAlgo %} {% can_view_all SshFprAlgo %}
<a class="list-group-item list-group-item-info" href="{% url "machines:index-sshfpralgo" %}"> <a class="list-group-item list-group-item-info" href="{% url "machines:index-sshfpralgo" %}">
<i class="fa fa-list-ul"></i> <i class="fa fa-list-ul"></i>
Algo de fingerprint ssh SSH fingerprint algorithm
</a> </a>
{% acl_end %} {% acl_end %}
{% can_view_all IpType %} {% can_view_all IpType %}

View file

@ -468,7 +468,7 @@ def del_ipv6list(request, ipv6list, **_kwargs):
@can_create(SshFingerprint) @can_create(SshFingerprint)
@can_edit(Machine) @can_edit(Machine)
def new_sshfingerprint(request, machine, **_kwargs): def new_sshfingerprint(request, machine, **_kwargs):
"""Nouvelle sshfingerprint""" """Creates an SSH fingerprint"""
sshfingerprint_instance = SshFingerprint(machine=machine) sshfingerprint_instance = SshFingerprint(machine=machine)
sshfingerprint = SshFingerprintForm( sshfingerprint = SshFingerprintForm(
request.POST or None, request.POST or None,
@ -476,13 +476,13 @@ def new_sshfingerprint(request, machine, **_kwargs):
) )
if sshfingerprint.is_valid(): if sshfingerprint.is_valid():
sshfingerprint.save() sshfingerprint.save()
messages.success(request, "Fingerprint ssh ajoutée") messages.success(request, "The SSH fingerprint was added")
return redirect(reverse( return redirect(reverse(
'machines:index-sshfingerprint', 'machines:index-sshfingerprint',
kwargs={'machineid': str(machine.id)} kwargs={'machineid': str(machine.id)}
)) ))
return form( return form(
{'sshfingerprintform': sshfingerprint, 'action_name': 'Créer'}, {'sshfingerprintform': sshfingerprint, 'action_name': 'Create'},
'machines/machine.html', 'machines/machine.html',
request request
) )
@ -491,7 +491,7 @@ def new_sshfingerprint(request, machine, **_kwargs):
@login_required @login_required
@can_edit(SshFingerprint) @can_edit(SshFingerprint)
def edit_sshfingerprint(request, sshfingerprint_instance, **_kwargs): def edit_sshfingerprint(request, sshfingerprint_instance, **_kwargs):
"""Edition d'une sshfingerprint""" """Edits an SSH fingerprint"""
sshfingerprint = SshFingerprintForm( sshfingerprint = SshFingerprintForm(
request.POST or None, request.POST or None,
instance=sshfingerprint_instance instance=sshfingerprint_instance
@ -499,13 +499,13 @@ def edit_sshfingerprint(request, sshfingerprint_instance, **_kwargs):
if sshfingerprint.is_valid(): if sshfingerprint.is_valid():
if sshfingerprint.changed_data: if sshfingerprint.changed_data:
sshfingerprint.save() sshfingerprint.save()
messages.success(request, "Ssh fingerprint modifiée") messages.success(request, "The SSH fingerprint was edited")
return redirect(reverse( return redirect(reverse(
'machines:index-sshfingerprint', 'machines:index-sshfingerprint',
kwargs={'machineid': str(sshfingerprint_instance.machine.id)} kwargs={'machineid': str(sshfingerprint_instance.machine.id)}
)) ))
return form( return form(
{'sshfingerprintform': sshfingerprint, 'action_name': 'Editer'}, {'sshfingerprintform': sshfingerprint, 'action_name': 'Edit'},
'machines/machine.html', 'machines/machine.html',
request request
) )
@ -514,11 +514,11 @@ def edit_sshfingerprint(request, sshfingerprint_instance, **_kwargs):
@login_required @login_required
@can_delete(SshFingerprint) @can_delete(SshFingerprint)
def del_sshfingerprint(request, sshfingerprint, **_kwargs): def del_sshfingerprint(request, sshfingerprint, **_kwargs):
""" Supprime une sshfingerprint""" """Deletes an SSH fingerprint"""
if request.method == "POST": if request.method == "POST":
machineid = sshfingerprint.machine.id machineid = sshfingerprint.machine.id
sshfingerprint.delete() sshfingerprint.delete()
messages.success(request, "La sshfingerprint a été détruite") messages.success(request, "The SSH fingerprint was deleted")
return redirect(reverse( return redirect(reverse(
'machines:index-sshfingerprint', 'machines:index-sshfingerprint',
kwargs={'machineid': str(machineid)} kwargs={'machineid': str(machineid)}
@ -533,18 +533,18 @@ def del_sshfingerprint(request, sshfingerprint, **_kwargs):
@login_required @login_required
@can_create(SshFprAlgo) @can_create(SshFprAlgo)
def new_sshfpralgo(request, **_kwargs): def new_sshfpralgo(request, **_kwargs):
"""Nouvelle sshfpralgo""" """Creates an SSH fingeprint algorithm"""
sshfpralgo = SshFprAlgoForm( sshfpralgo = SshFprAlgoForm(
request.POST or None, request.POST or None,
) )
if sshfpralgo.is_valid(): if sshfpralgo.is_valid():
sshfpralgo.save() sshfpralgo.save()
messages.success(request, "Algo Fingerprint ssh ajouté") messages.success(request, "The SSH fingerprint algorithm was added")
return redirect(reverse( return redirect(reverse(
'machines:index-sshfpralgo' 'machines:index-sshfpralgo'
)) ))
return form( return form(
{'sshfpralgoform': sshfpralgo, 'action_name': 'Créer'}, {'sshfpralgoform': sshfpralgo, 'action_name': 'Create'},
'machines/machine.html', 'machines/machine.html',
request request
) )
@ -553,7 +553,7 @@ def new_sshfpralgo(request, **_kwargs):
@login_required @login_required
@can_edit(SshFprAlgo) @can_edit(SshFprAlgo)
def edit_sshfpralgo(request, sshfpralgo_instance, **_kwargs): def edit_sshfpralgo(request, sshfpralgo_instance, **_kwargs):
"""Edition d'une sshfpralgo""" """Edits an SSH fingerprint algorithm"""
sshfpralgo = SshFprAlgoForm( sshfpralgo = SshFprAlgoForm(
request.POST or None, request.POST or None,
instance=sshfpralgo_instance instance=sshfpralgo_instance
@ -561,12 +561,12 @@ def edit_sshfpralgo(request, sshfpralgo_instance, **_kwargs):
if sshfpralgo.is_valid(): if sshfpralgo.is_valid():
if sshfpralgo.changed_data: if sshfpralgo.changed_data:
sshfpralgo.save() sshfpralgo.save()
messages.success(request, "Algo de sshfp modifiée") messages.success(request, "The SSH fingerprint algorithm was edited")
return redirect(reverse( return redirect(reverse(
'machines:index-sshfpralgo' 'machines:index-sshfpralgo'
)) ))
return form( return form(
{'sshfpralgoform': sshfpralgo, 'action_name': 'Editer'}, {'sshfpralgoform': sshfpralgo, 'action_name': 'Edit'},
'machines/machine.html', 'machines/machine.html',
request request
) )
@ -575,16 +575,16 @@ def edit_sshfpralgo(request, sshfpralgo_instance, **_kwargs):
@login_required @login_required
@can_delete(SshFprAlgo) @can_delete(SshFprAlgo)
def del_sshfpralgo(request, sshfpralgo, **_kwargs): def del_sshfpralgo(request, sshfpralgo, **_kwargs):
""" Supprime une sshfpralgo""" """Deletes an SSH fingerprint algorithm"""
if request.method == "POST": if request.method == "POST":
try: try:
sshfpralgo.delete() sshfpralgo.delete()
messages.success(request, "La sshfpralgo a été détruite") messages.success(request, "The SSH fingerprint algorithm was deleted")
except ProtectedError: except ProtectedError:
messages.error( messages.error(
request, request,
("L'algo est affectée à au moins une fingerprint ssh, " ("This SSH fingerprint algorithm is used by at least one SSH"
"vous ne pouvez pas le supprimer") "fingerprint and thus can not be deleted.")
) )
return redirect(reverse( return redirect(reverse(
'machines:index-sshfpralgo' 'machines:index-sshfpralgo'
@ -1524,9 +1524,9 @@ def index_alias(request, interface, interfaceid):
@login_required @login_required
@can_edit(Machine) @can_view_all(Machine)
def index_sshfingerprint(request, machine, machineid): def index_sshfingerprint(request, machine, machineid):
""" View used to display the list of existing IPv6 of an interface """ """View used to display the list of existing SSH fingerprint of a machine"""
sshfingerprint_list = SshFingerprint.objects.filter(machine=machine) sshfingerprint_list = SshFingerprint.objects.filter(machine=machine)
return render( return render(
request, request,
@ -1538,7 +1538,7 @@ def index_sshfingerprint(request, machine, machineid):
@login_required @login_required
@can_view_all(SshFprAlgo) @can_view_all(SshFprAlgo)
def index_sshfpralgo(request): def index_sshfpralgo(request):
""" View used to display the list of existing sshfrpalgo""" """View used to display the list of existing SSH fingerprint algorithm"""
sshfpralgo_list = SshFprAlgo.objects.all() sshfpralgo_list = SshFprAlgo.objects.all()
return render( return render(
request, request,