8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Mark strings for translation in topologie

This commit is contained in:
Laouen Fernet 2019-11-16 14:14:22 +00:00 committed by chirac
parent 6522051728
commit 207c8ba206
18 changed files with 84 additions and 83 deletions

View file

@ -41,6 +41,6 @@ def can_view(user):
can = user.has_module_perms("topologie") can = user.has_module_perms("topologie")
return ( return (
can, can,
None if can else _("You don't have the right to view this" " application."), None if can else _("You don't have the right to view this application."),
("topologie",), ("topologie",),
) )

View file

@ -84,7 +84,7 @@ class Stack(AclMixin, RevMixin, models.Model):
""" Verification que l'id_max < id_min""" """ Verification que l'id_max < id_min"""
if self.member_id_max < self.member_id_min: if self.member_id_max < self.member_id_min:
raise ValidationError( raise ValidationError(
{"member_id_max": _("The maximum ID is less than the" " minimum ID.")} {"member_id_max": _("The maximum ID is less than the minimum ID.")}
) )
@ -96,7 +96,7 @@ class AccessPoint(AclMixin, Machine):
location = models.CharField( location = models.CharField(
max_length=255, max_length=255,
help_text=_("Details about the AP's location"), help_text=_("Details about the AP's location."),
blank=True, blank=True,
null=True, null=True,
) )
@ -187,7 +187,7 @@ class Switch(AclMixin, Machine):
Validation au save que l'id du stack est bien dans le range id_min Validation au save que l'id du stack est bien dans le range id_min
id_max de la stack parente""" id_max de la stack parente"""
number = models.PositiveIntegerField(help_text=_("Number of ports")) number = models.PositiveIntegerField(help_text=_("Number of ports."))
stack = models.ForeignKey( stack = models.ForeignKey(
"topologie.Stack", blank=True, null=True, on_delete=models.SET_NULL "topologie.Stack", blank=True, null=True, on_delete=models.SET_NULL
) )
@ -197,7 +197,7 @@ class Switch(AclMixin, Machine):
blank=True, blank=True,
null=True, null=True,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
help_text=_("Switch model"), help_text=_("Switch model."),
) )
switchbay = models.ForeignKey( switchbay = models.ForeignKey(
"topologie.SwitchBay", blank=True, null=True, on_delete=models.SET_NULL "topologie.SwitchBay", blank=True, null=True, on_delete=models.SET_NULL
@ -207,17 +207,17 @@ class Switch(AclMixin, Machine):
blank=True, blank=True,
null=True, null=True,
on_delete=models.PROTECT, on_delete=models.PROTECT,
help_text=_("RADIUS key of the switch"), help_text=_("RADIUS key of the switch."),
) )
management_creds = models.ForeignKey( management_creds = models.ForeignKey(
"preferences.SwitchManagementCred", "preferences.SwitchManagementCred",
blank=True, blank=True,
null=True, null=True,
on_delete=models.PROTECT, on_delete=models.PROTECT,
help_text=_("Management credentials for the switch"), help_text=_("Management credentials for the switch."),
) )
automatic_provision = models.BooleanField( automatic_provision = models.BooleanField(
default=False, help_text=_("Automatic provision for the switch") default=False, help_text=_("Automatic provision for the switch.")
) )
class Meta: class Meta:
@ -245,14 +245,14 @@ class Switch(AclMixin, Machine):
) )
else: else:
raise ValidationError( raise ValidationError(
{"stack_member_id": _("The stack member ID can't be" " void.")} {"stack_member_id": _("The stack member ID can't be void.")}
) )
def create_ports(self, begin, end): def create_ports(self, begin, end):
""" Crée les ports de begin à end si les valeurs données """ Crée les ports de begin à end si les valeurs données
sont cohérentes. """ sont cohérentes. """
if end < begin: if end < begin:
raise ValidationError(_("The end port is less than the start" " port.")) raise ValidationError(_("The end port is less than the start port."))
ports_to_create = range(begin, end + 1) ports_to_create = range(begin, end + 1)
existing_ports = Port.objects.filter(switch=self.switch).values_list( existing_ports = Port.objects.filter(switch=self.switch).values_list(
"port", flat=True "port", flat=True
@ -262,7 +262,7 @@ class Switch(AclMixin, Machine):
if len(non_existing_ports) + existing_ports.count() > self.number: if len(non_existing_ports) + existing_ports.count() > self.number:
raise ValidationError(_("This switch can't have that many ports.")) raise ValidationError(_("This switch can't have that many ports."))
with transaction.atomic(), reversion.create_revision(): with transaction.atomic(), reversion.create_revision():
reversion.set_comment(_("Creation")) reversion.set_comment("Creation")
Port.objects.bulk_create( Port.objects.bulk_create(
[ [
Port(switch=self.switch, port=port_id) Port(switch=self.switch, port=port_id)
@ -491,15 +491,15 @@ class ModuleSwitch(AclMixin, RevMixin, models.Model):
reference = models.CharField( reference = models.CharField(
max_length=255, max_length=255,
help_text=_("Reference of a module"), help_text=_("Reference of a module."),
verbose_name=_("Module reference"), verbose_name=_("module reference"),
) )
comment = models.CharField( comment = models.CharField(
max_length=255, max_length=255,
null=True, null=True,
blank=True, blank=True,
help_text=_("Comment"), help_text=_("Comment."),
verbose_name=_("Comment"), verbose_name=_("comment"),
) )
class Meta: class Meta:
@ -517,14 +517,14 @@ class ModuleOnSwitch(AclMixin, RevMixin, models.Model):
module = models.ForeignKey("ModuleSwitch", on_delete=models.CASCADE) module = models.ForeignKey("ModuleSwitch", on_delete=models.CASCADE)
switch = models.ForeignKey("Switch", on_delete=models.CASCADE) switch = models.ForeignKey("Switch", on_delete=models.CASCADE)
slot = models.CharField( slot = models.CharField(
max_length=15, help_text=_("Slot on switch"), verbose_name=_("Slot") max_length=15, help_text=_("Slot on switch."), verbose_name=_("slot")
) )
class Meta: class Meta:
permissions = ( permissions = (
( (
"view_moduleonswitch", "view_moduleonswitch",
_("Can view a link between switch and" " module object"), _("Can view a link between switch and module object"),
), ),
) )
verbose_name = _("link between switch and module") verbose_name = _("link between switch and module")
@ -532,7 +532,7 @@ class ModuleOnSwitch(AclMixin, RevMixin, models.Model):
unique_together = ["slot", "switch"] unique_together = ["slot", "switch"]
def __str__(self): def __str__(self):
return _("On slot ") + str(self.slot) + _(" of ") + str(self.switch) return _("On slot %(slot)s of %(switch)s").format(slot=str(self.slot), switch=str(self.switch))
class ConstructorSwitch(AclMixin, RevMixin, models.Model): class ConstructorSwitch(AclMixin, RevMixin, models.Model):
@ -542,10 +542,10 @@ class ConstructorSwitch(AclMixin, RevMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_constructorswitch", _("Can view a switch constructor" " object")), ("view_constructorswitch", _("Can view a switch constructor object")),
) )
verbose_name = _("switch constructor") verbose_name = _("switch constructor")
verbose_name_plural = "switch constructors" verbose_name_plural = _("switch constructors")
def __str__(self): def __str__(self):
return self.name return self.name
@ -655,8 +655,8 @@ class Port(AclMixin, RevMixin, models.Model):
) )
state = models.BooleanField( state = models.BooleanField(
default=True, default=True,
help_text=_("Port state Active"), help_text=_("Port state Active."),
verbose_name=_("Port state Active"), verbose_name=_("port state Active"),
) )
details = models.CharField(max_length=255, blank=True) details = models.CharField(max_length=255, blank=True)
@ -809,13 +809,13 @@ class PortProfile(AclMixin, RevMixin, models.Model):
("asso_machine", _("Organisation machine")), ("asso_machine", _("Organisation machine")),
("nothing", _("Nothing")), ("nothing", _("Nothing")),
) )
name = models.CharField(max_length=255, verbose_name=_("Name")) name = models.CharField(max_length=255, verbose_name=_("name"))
profil_default = models.CharField( profil_default = models.CharField(
max_length=32, max_length=32,
choices=PROFIL_DEFAULT, choices=PROFIL_DEFAULT,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Default profile"), verbose_name=_("default profile"),
) )
on_dormitory = models.ForeignKey( on_dormitory = models.ForeignKey(
"topologie.Dormitory", "topologie.Dormitory",
@ -823,7 +823,7 @@ class PortProfile(AclMixin, RevMixin, models.Model):
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Profil on dormitory"), verbose_name=_("profile on dormitory"),
) )
vlan_untagged = models.ForeignKey( vlan_untagged = models.ForeignKey(
"machines.Vlan", "machines.Vlan",
@ -843,7 +843,7 @@ class PortProfile(AclMixin, RevMixin, models.Model):
max_length=32, max_length=32,
choices=TYPES, choices=TYPES,
help_text=_( help_text=_(
"Type of RADIUS authentication : inactive, MAC-address or" " 802.1X" "Type of RADIUS authentication: inactive, MAC-address or 802.1X."
), ),
verbose_name=_("RADIUS type"), verbose_name=_("RADIUS type"),
) )
@ -852,44 +852,44 @@ class PortProfile(AclMixin, RevMixin, models.Model):
choices=MODES, choices=MODES,
default="COMMON", default="COMMON",
help_text=_( help_text=_(
"In case of MAC-authentication : mode COMMON or STRICT on" " this port" "In case of MAC-authentication: mode COMMON or STRICT on this port."
), ),
verbose_name=_("RADIUS mode"), verbose_name=_("RADIUS mode"),
) )
speed = models.CharField( speed = models.CharField(
max_length=32, choices=SPEED, default="auto", help_text=_("Port speed limit") max_length=32, choices=SPEED, default="auto", help_text=_("Port speed limit.")
) )
mac_limit = models.IntegerField( mac_limit = models.IntegerField(
null=True, null=True,
blank=True, blank=True,
help_text=_("Limit of MAC-address on this port"), help_text=_("Limit of MAC-address on this port."),
verbose_name=_("MAC limit"), verbose_name=_("MAC limit"),
) )
flow_control = models.BooleanField(default=False, help_text=_("Flow control")) flow_control = models.BooleanField(default=False, help_text=_("Flow control."))
dhcp_snooping = models.BooleanField( dhcp_snooping = models.BooleanField(
default=False, default=False,
help_text=_("Protect against rogue DHCP"), help_text=_("Protect against rogue DHCP."),
verbose_name=_("DHCP snooping"), verbose_name=_("DHCP snooping"),
) )
dhcpv6_snooping = models.BooleanField( dhcpv6_snooping = models.BooleanField(
default=False, default=False,
help_text=_("Protect against rogue DHCPv6"), help_text=_("Protect against rogue DHCPv6."),
verbose_name=_("DHCPv6 snooping"), verbose_name=_("DHCPv6 snooping"),
) )
arp_protect = models.BooleanField( arp_protect = models.BooleanField(
default=False, default=False,
help_text=_("Check if IP adress is DHCP assigned"), help_text=_("Check if IP address is DHCP assigned."),
verbose_name=_("ARP protection"), verbose_name=_("ARP protection"),
) )
ra_guard = models.BooleanField( ra_guard = models.BooleanField(
default=False, default=False,
help_text=_("Protect against rogue RA"), help_text=_("Protect against rogue RA."),
verbose_name=_("RA guard"), verbose_name=_("RA guard"),
) )
loop_protect = models.BooleanField( loop_protect = models.BooleanField(
default=False, default=False,
help_text=_("Protect against loop"), help_text=_("Protect against loop."),
verbose_name=_("Loop protection"), verbose_name=_("loop protection"),
) )
class Meta: class Meta:
@ -933,7 +933,7 @@ class PortProfile(AclMixin, RevMixin, models.Model):
raise ValidationError( raise ValidationError(
{ {
"profil_default": _( "profil_default": _(
"A default profile for all dormitory of that type already exists." "A default profile for all dormitories of that type already exists."
) )
} }
) )

View file

@ -35,7 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
{% trans "Dormitory" as tr_dormitory %} {% trans "Dormitory" as tr_dormitory %}
<th>{% include 'buttons/sort.html' with prefix='dormitory' col='name' text=tr_dormitory %}</th> <th>{% include 'buttons/sort.html' with prefix='dormitory' col='name' text=tr_dormitory %}</th>
<th>{% trans "Building" %}</th> <th>{% trans "Buildings" %}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View file

@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% trans "Reference" as tr_ref %} {% trans "Reference" as tr_ref %}
<th>{% include 'buttons/sort.html' with prefix='model-switch' col='reference' text=tr_ref %}</th> <th>{% include 'buttons/sort.html' with prefix='model-switch' col='reference' text=tr_ref %}</th>
<th>{% trans "Commercial name" %}</th> <th>{% trans "Commercial name" %}</th>
<th>Firmware</th> <th>{% trans "Firmware" %}</th>
{% trans "Switch constructor" as tr_constructor %} {% trans "Switch constructor" as tr_constructor %}
<th>{% include 'buttons/sort.html' with prefix='model-switch' col='constructor' text=tr_constructor %}</th> <th>{% include 'buttons/sort.html' with prefix='model-switch' col='constructor' text=tr_constructor %}</th>
<th>{% trans "Switches" %} <th>{% trans "Switches" %}

View file

@ -35,7 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead> <thead>
<tr> <tr>
<th>{% trans "Name" %}</th> <th>{% trans "Name" %}</th>
<th>{% trans "Default for and place" %}</th> <th>{% trans "Default for" %}</th>
<th>{% trans "VLANs" %}</th> <th>{% trans "VLANs" %}</th>
<th>{% trans "RADIUS settings" %}</th> <th>{% trans "RADIUS settings" %}</th>
<th>{% trans "Speed limit" %}</th> <th>{% trans "Speed limit" %}</th>
@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for port_profile in port_profile_list %} {% for port_profile in port_profile_list %}
<tr> <tr>
<td>{{ port_profile.name }}</td> <td>{{ port_profile.name }}</td>
<td>{{ port_profile.profil_default }} {% if port_profile.profil_default%}<b> - {% if port_profile.on_dormitory %} on {{ port_profile.on_dormitory }} {% else %} Everywhere {% endif %}</b>{% endif %}</td> <td>{{ port_profile.profil_default }} {% if port_profile.profil_default%}<b> - {% if port_profile.on_dormitory %}{% blocktrans with dorm=port_profile.on_dormitory %} on {{ dorm }}{% endblocktrans %}{% else %}{% trans "Everywhere" %}{% endif %}</b>{% endif %}</td>
<td> <td>
{% if port_profile.vlan_untagged %} {% if port_profile.vlan_untagged %}
<b>{% trans "Untagged: " %}</b>{{ port_profile.vlan_untagged }} <b>{% trans "Untagged: " %}</b>{{ port_profile.vlan_untagged }}

View file

@ -44,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include 'buttons/sort.html' with prefix='switch' col='ports' text=tr_ports %}</th> <th>{% include 'buttons/sort.html' with prefix='switch' col='ports' text=tr_ports %}</th>
{% trans "Stack" as tr_stack %} {% trans "Stack" as tr_stack %}
<th>{% include 'buttons/sort.html' with prefix='switch' col='stack' text=tr_stack %}</th> <th>{% include 'buttons/sort.html' with prefix='switch' col='stack' text=tr_stack %}</th>
<th>{% trans "Stack ID" %}</th> <th>{% trans "Stack member ID" %}</th>
<th>{% trans "Switch model" %}</th> <th>{% trans "Switch model" %}</th>
<th>{% trans "Details" %}</th> <th>{% trans "Details" %}</th>
<th></th> <th></th>

View file

@ -65,7 +65,7 @@ function toggle_graph() {
<h2>{% trans "Switches" %}</h2> <h2>{% trans "Switches" %}</h2>
{% can_create Switch %} {% can_create Switch %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch' %}"><i class="fa fa-plus"></i>{% trans " Add a switch" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch' %}"><i class="fa fa-plus"></i> {% trans "Add a switch" %}</a>
<hr> <hr>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_switch.html' with switch_list=switch_list %} {% include 'topologie/aff_switch.html' with switch_list=switch_list %}

View file

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "Access points" %}</h2> <h2>{% trans "Access points" %}</h2>
{% can_create AccessPoint %} {% can_create AccessPoint %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-ap' %}"><i class="fa fa-plus"></i>{% trans " Add an access point" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-ap' %}"><i class="fa fa-plus"></i> {% trans "Add an access point" %}</a>
<hr> <hr>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_ap.html' with ap_list=ap_list %} {% include 'topologie/aff_ap.html' with ap_list=ap_list %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Switch models" %}</h2> <h2>{% trans "Switch models" %}</h2>
{% can_create ModelSwitch %} {% can_create ModelSwitch %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-model-switch' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-model-switch' %}">
<i class="fa fa-plus"></i>{% trans " Add a switch model" %} <i class="fa fa-plus"></i> {% trans "Add a switch model" %}
</a> </a>
<hr> <hr>
{% acl_end %} {% acl_end %}
@ -42,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Switch constructors" %}</h2> <h2>{% trans "Switch constructors" %}</h2>
{% can_create ConstructorSwitch %} {% can_create ConstructorSwitch %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-constructor-switch' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-constructor-switch' %}">
<i class="fa fa-plus"></i>{% trans " Add a switch constructor" %} <i class="fa fa-plus"></i> {% trans "Add a switch constructor" %}
</a> </a>
<hr> <hr>
{% acl_end %} {% acl_end %}

View file

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "Switch modules" %}</h2> <h2>{% trans "Switch modules" %}</h2>
{% can_create ModuleSwitch %} {% can_create ModuleSwitch %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:add-module' %}"><i class="fa fa-plus"></i>{% trans " Add a module" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:add-module' %}"><i class="fa fa-plus"></i> {% trans "Add a module" %}</a>
<hr> <hr>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_modules.html' with module_list=module_list modular_switchs=modular_switchs %} {% include 'topologie/aff_modules.html' with module_list=module_list modular_switchs=modular_switchs %}

View file

@ -48,8 +48,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<hr> <hr>
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=id_switch %} {% include 'buttons/edit.html' with href='topologie:edit-switch' id=id_switch %}
{% can_create Port %} {% can_create Port %}
{% include 'buttons/add.html' with href='topologie:new-port' id=id_switch %} <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port' id_switch %}"><i class="fa fa-plus"></i> {% trans "Add a port" %}</a>
{% include 'buttons/add.html' with href='topologie:create-ports' id=id_switch %} <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:create-ports' id_switch %}"><i class="fa fa-plus"></i> {% trans "Add ports to the port list" %}</a>
{% acl_end %} {% acl_end %}
<hr> <hr>
{% include 'topologie/aff_repr_switch.html' with port_list=port_list %} {% include 'topologie/aff_repr_switch.html' with port_list=port_list %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Stacks" %}</h2> <h2>{% trans "Stacks" %}</h2>
{% can_create Stack %} {% can_create Stack %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-stack' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-stack' %}">
<i class="fa fa-plus"></i>{% trans " Add a stack" %} <i class="fa fa-plus"></i> {% trans "Add a stack" %}
</a> </a>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_stacks.html' with stack_list=stack_list %} {% include 'topologie/aff_stacks.html' with stack_list=stack_list %}
@ -41,7 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Switch bays" %}</h2> <h2>{% trans "Switch bays" %}</h2>
{% can_create SwitchBay %} {% can_create SwitchBay %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch-bay' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-switch-bay' %}">
<i class="fa fa-plus"></i>{% trans " Add a switch bay" %} <i class="fa fa-plus"></i> {% trans "Add a switch bay" %}
</a> </a>
<hr> <hr>
{% acl_end %} {% acl_end %}
@ -50,7 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Buildings" %}</h2> <h2>{% trans "Buildings" %}</h2>
{% can_create Building %} {% can_create Building %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-building' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-building' %}">
<i class="fa fa-plus"></i>{% trans " Add a building" %} <i class="fa fa-plus"></i> {% trans "Add a building" %}
</a> </a>
<hr> <hr>
{% acl_end %} {% acl_end %}
@ -60,7 +60,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Dormitories" %}</h2> <h2>{% trans "Dormitories" %}</h2>
{% can_create Dormitory %} {% can_create Dormitory %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-dormitory' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-dormitory' %}">
<i class="fa fa-plus"></i>{% trans " Add a dormitory" %} <i class="fa fa-plus"></i> {% trans "Add a dormitory" %}
</a> </a>
<hr> <hr>
{% acl_end %} {% acl_end %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "Port profiles" %}</h2> <h2>{% trans "Port profiles" %}</h2>
{% can_create PortProfile %} {% can_create PortProfile %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port-profile' %}"><i class="fa fa-plus"></i>{% trans " Add a port profile" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port-profile' %}"><i class="fa fa-plus"></i> {% trans "Add a port profile" %}</a>
<hr> <hr>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_port_profile.html' with port_profile_list=port_profile_list %} {% include 'topologie/aff_port_profile.html' with port_profile_list=port_profile_list %}

View file

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2>{% trans "Rooms" %}</h2> <h2>{% trans "Rooms" %}</h2>
{% can_create Room %} {% can_create Room %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-room' %}"><i class="fa fa-plus"></i>{% trans " Add a room" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-room' %}"><i class="fa fa-plus"></i> {% trans "Add a room" %}</a>
<hr> <hr>
{% acl_end %} {% acl_end %}
{% include 'topologie/aff_chambres.html' with room_list=room_list %} {% include 'topologie/aff_chambres.html' with room_list=room_list %}

View file

@ -36,15 +36,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<a class="btn btn-primary" href="{% url 'topologie:index-port' id_switch %}" role="button">{% bootstrap_icon "list" %}{% trans " Go to the ports list" %}</a> <a class="btn btn-primary" href="{% url 'topologie:index-port' id_switch %}" role="button">{% bootstrap_icon "list" %} {% trans "Go to the ports list" %}</a>
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}
{% if topoform %} {% if topoform %}
<h3>{% trans "Specific settings for the switch" %}</h3> <h3>{% trans "Specific settings for the switch" %}</h3>
{% massive_bootstrap_form topoform 'switch_interface' %} {% massive_bootstrap_form topoform 'switch_interface' %}
{% endif %} {% endif %}
{% trans "Create" as tr_create %} {% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_create button_type="submit" icon='ok' button_class='btn-success' %} {% bootstrap_button tr_confirm button_type="submit" icon='ok' button_class='btn-success' %}
</form> </form>
<br /> <br />
<br /> <br />

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% bootstrap_form_errors topoform %} {% bootstrap_form_errors topoform %}
{% if id_switch %} {% if id_switch %}
<a class="btn btn-primary" href="{% url 'topologie:index-port' id_switch %}" role="button">{% bootstrap_icon "list" %}{% trans " Go to the ports list" %}</a> <a class="btn btn-primary" href="{% url 'topologie:index-port' id_switch %}" role="button">{% bootstrap_icon "list" %} {% trans "Go to the ports list" %}</a>
{% endif %} {% endif %}
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}

View file

@ -56,8 +56,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h3>{% trans "DNS name" %}</h3> <h3>{% trans "DNS name" %}</h3>
{% bootstrap_form domainform %} {% bootstrap_form domainform %}
{% endif %} {% endif %}
{% trans "Create or edit" as tr_create_or_edit %} {% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_create_or_edit button_type="submit" icon='ok' button_class='btn-success' %} {% bootstrap_button tr_confirm button_type="submit" icon='ok' button_class='btn-success' %}
</form> </form>
<br /> <br />
<br /> <br />

View file

@ -442,7 +442,7 @@ def new_stack(request):
messages.success(request, _("The stack was created.")) messages.success(request, _("The stack was created."))
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"topoform": stack, "action_name": _("Create")}, "topologie/topo.html", request {"topoform": stack, "action_name": _("Add")}, "topologie/topo.html", request
) )
@ -454,6 +454,7 @@ def edit_stack(request, stack, **_kwargs):
if stack.is_valid(): if stack.is_valid():
if stack.changed_data: if stack.changed_data:
stack.save() stack.save()
messages.success(request, _("The stack was edited."))
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"topoform": stack, "action_name": _("Edit")}, "topologie/topo.html", request {"topoform": stack, "action_name": _("Edit")}, "topologie/topo.html", request
@ -538,7 +539,7 @@ def new_switch(request):
"machineform": switch, "machineform": switch,
"domainform": domain, "domainform": domain,
"i_mbf_param": i_mbf_param, "i_mbf_param": i_mbf_param,
"device": "switch", "device": _("switch"),
}, },
"topologie/topo_more.html", "topologie/topo_more.html",
request, request,
@ -611,7 +612,7 @@ def edit_switch(request, switch, switchid):
"machineform": switch_form, "machineform": switch_form,
"domainform": domain_form, "domainform": domain_form,
"i_mbf_param": i_mbf_param, "i_mbf_param": i_mbf_param,
"device": "switch", "device": _("switch"),
}, },
"topologie/topo_more.html", "topologie/topo_more.html",
request, request,
@ -660,7 +661,7 @@ def new_ap(request):
"machineform": ap, "machineform": ap,
"domainform": domain, "domainform": domain,
"i_mbf_param": i_mbf_param, "i_mbf_param": i_mbf_param,
"device": "wifi ap", "device": _("access point"),
}, },
"topologie/topo_more.html", "topologie/topo_more.html",
request, request,
@ -712,7 +713,7 @@ def edit_ap(request, ap, **_kwargs):
"machineform": ap_form, "machineform": ap_form,
"domainform": domain_form, "domainform": domain_form,
"i_mbf_param": i_mbf_param, "i_mbf_param": i_mbf_param,
"device": "wifi ap", "device": _("access point"),
}, },
"topologie/topo_more.html", "topologie/topo_more.html",
request, request,
@ -729,7 +730,7 @@ def new_room(request):
messages.success(request, _("The room was created.")) messages.success(request, _("The room was created."))
return redirect(reverse("topologie:index-room")) return redirect(reverse("topologie:index-room"))
return form( return form(
{"topoform": room, "action_name": _("Create")}, "topologie/topo.html", request {"topoform": room, "action_name": _("Add")}, "topologie/topo.html", request
) )
@ -769,7 +770,7 @@ def del_room(request, room, **_kwargs):
) )
return redirect(reverse("topologie:index-room")) return redirect(reverse("topologie:index-room"))
return form( return form(
{"objet": room, "objet_name": _("Room")}, "topologie/delete.html", request {"objet": room, "objet_name": _("room")}, "topologie/delete.html", request
) )
@ -783,7 +784,7 @@ def new_model_switch(request):
messages.success(request, _("The switch model was created.")) messages.success(request, _("The switch model was created."))
return redirect(reverse("topologie:index-model-switch")) return redirect(reverse("topologie:index-model-switch"))
return form( return form(
{"topoform": model_switch, "action_name": _("Create")}, {"topoform": model_switch, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -828,7 +829,7 @@ def del_model_switch(request, model_switch, **_kwargs):
) )
return redirect(reverse("topologie:index-model-switch")) return redirect(reverse("topologie:index-model-switch"))
return form( return form(
{"objet": model_switch, "objet_name": _("Switch model")}, {"objet": model_switch, "objet_name": _("switch model")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -844,7 +845,7 @@ def new_switch_bay(request):
messages.success(request, _("The switch bay was created.")) messages.success(request, _("The switch bay was created."))
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"topoform": switch_bay, "action_name": _("Create")}, {"topoform": switch_bay, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -888,7 +889,7 @@ def del_switch_bay(request, switch_bay, **_kwargs):
) )
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"objet": switch_bay, "objet_name": _("Switch bay")}, {"objet": switch_bay, "objet_name": _("switch bay")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -905,7 +906,7 @@ def new_building(request):
messages.success(request, _("The building was created.")) messages.success(request, _("The building was created."))
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"topoform": building, "action_name": _("Create")}, {"topoform": building, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -949,7 +950,7 @@ def del_building(request, building, **_kwargs):
) )
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"objet": building, "objet_name": _("Building")}, {"objet": building, "objet_name": _("building")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -966,7 +967,7 @@ def new_dormitory(request):
messages.success(request, _("The dormitory was created.")) messages.success(request, _("The dormitory was created."))
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"topoform": dormitory, "action_name": _("Create")}, {"topoform": dormitory, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -1012,7 +1013,7 @@ def del_dormitory(request, dormitory, **_kwargs):
) )
return redirect(reverse("topologie:index-physical-grouping")) return redirect(reverse("topologie:index-physical-grouping"))
return form( return form(
{"objet": dormitory, "objet_name": _("Dormitory")}, {"objet": dormitory, "objet_name": _("dormitory")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -1028,7 +1029,7 @@ def new_constructor_switch(request):
messages.success(request, _("The switch constructor was created.")) messages.success(request, _("The switch constructor was created."))
return redirect(reverse("topologie:index-model-switch")) return redirect(reverse("topologie:index-model-switch"))
return form( return form(
{"topoform": constructor_switch, "action_name": _("Create")}, {"topoform": constructor_switch, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -1075,7 +1076,7 @@ def del_constructor_switch(request, constructor_switch, **_kwargs):
) )
return redirect(reverse("topologie:index-model-switch")) return redirect(reverse("topologie:index-model-switch"))
return form( return form(
{"objet": constructor_switch, "objet_name": _("Switch constructor")}, {"objet": constructor_switch, "objet_name": _("switch constructor")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -1091,7 +1092,7 @@ def new_port_profile(request):
messages.success(request, _("The port profile was created.")) messages.success(request, _("The port profile was created."))
return redirect(reverse("topologie:index-port-profile")) return redirect(reverse("topologie:index-port-profile"))
return form( return form(
{"topoform": port_profile, "action_name": _("Create")}, {"topoform": port_profile, "action_name": _("Add")},
"topologie/topo.html", "topologie/topo.html",
request, request,
) )
@ -1126,7 +1127,7 @@ def del_port_profile(request, port_profile, **_kwargs):
messages.success(request, _("Impossible to delete the port profile.")) messages.success(request, _("Impossible to delete the port profile."))
return redirect(reverse("topologie:index-port-profile")) return redirect(reverse("topologie:index-port-profile"))
return form( return form(
{"objet": port_profile, "objet_name": _("Port profile")}, {"objet": port_profile, "objet_name": _("port profile")},
"topologie/delete.html", "topologie/delete.html",
request, request,
) )
@ -1142,7 +1143,7 @@ def add_module(request):
messages.success(request, _("The module was created.")) messages.success(request, _("The module was created."))
return redirect(reverse("topologie:index-module")) return redirect(reverse("topologie:index-module"))
return form( return form(
{"topoform": module, "action_name": _("Create")}, "topologie/topo.html", request {"topoform": module, "action_name": _("Add")}, "topologie/topo.html", request
) )
@ -1182,7 +1183,7 @@ def del_module(request, module, **_kwargs):
) )
return redirect(reverse("topologie:index-module")) return redirect(reverse("topologie:index-module"))
return form( return form(
{"objet": module, "objet_name": _("Module")}, "topologie/delete.html", request {"objet": module, "objet_name": _("module")}, "topologie/delete.html", request
) )
@ -1238,7 +1239,7 @@ def del_module_on(request, module, **_kwargs):
) )
return redirect(reverse("topologie:index-module")) return redirect(reverse("topologie:index-module"))
return form( return form(
{"objet": module, "objet_name": _("Module")}, "topologie/delete.html", request {"objet": module, "objet_name": _("module")}, "topologie/delete.html", request
) )