mirror of https://gitlab.federez.net/re2o/re2o
committed by
root
9 changed files with 340 additions and 2 deletions
@ -0,0 +1,63 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.10.7 on 2018-12-30 14:56 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import re2o.mixins |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('topologie', '0066_modelswitch_commercial_name'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='ModuleOnSwitch', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('slot', models.CharField(help_text='Slot on switch', max_length=15, verbose_name='Slot')), |
|||
], |
|||
options={ |
|||
'verbose_name': 'link between switchs and modules', |
|||
'permissions': (('view_moduleonswitch', 'Can view a moduleonswitch object'),), |
|||
}, |
|||
bases=(re2o.mixins.AclMixin, re2o.mixins.RevMixin, models.Model), |
|||
), |
|||
migrations.CreateModel( |
|||
name='ModuleSwitch', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('reference', models.CharField(help_text='Reference of a module', max_length=255, verbose_name='Module reference')), |
|||
('comment', models.CharField(blank=True, help_text='Comment', max_length=255, null=True, verbose_name='Comment')), |
|||
('switchs', models.ManyToManyField(through='topologie.ModuleOnSwitch', to='topologie.Switch')), |
|||
], |
|||
options={ |
|||
'verbose_name': 'Module of a switch', |
|||
'permissions': (('view_moduleswitch', 'Can view a module object'),), |
|||
}, |
|||
bases=(re2o.mixins.AclMixin, re2o.mixins.RevMixin, models.Model), |
|||
), |
|||
migrations.AddField( |
|||
model_name='modelswitch', |
|||
name='is_itself_module', |
|||
field=models.BooleanField(default=False, help_text='Does the switch, itself, considered as a module'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='modelswitch', |
|||
name='is_modular', |
|||
field=models.BooleanField(default=False, help_text='Is this switch model modular'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='moduleonswitch', |
|||
name='module', |
|||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='topologie.ModuleSwitch'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='moduleonswitch', |
|||
name='switch', |
|||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='topologie.Switch'), |
|||
), |
|||
] |
|||
@ -0,0 +1,67 @@ |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
|
|||
{% load acl %} |
|||
{% load logs_extra %} |
|||
{% load i18n %} |
|||
|
|||
{% if module_list.paginator %} |
|||
{% include "pagination.html" with list=module_list %} |
|||
{% endif %} |
|||
|
|||
<table class="table table-striped"> |
|||
<thead> |
|||
<tr> |
|||
<th>{% trans "Reference" %}</th> |
|||
<th>{% trans "Comment" %}</th> |
|||
<th>{% trans "Switchs" %}</th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
{% for module in module_list %} |
|||
<tr> |
|||
<td>{{ module.reference }}</td> |
|||
<td>{{ module.comment }}</td> |
|||
<td>{{ module.switchs.all }}</td> |
|||
<td class="text-right"> |
|||
{% can_edit module %} |
|||
<a class="btn btn-primary btn-sm" role="button" title={% trans "Edit" %} href="{% url 'topologie:edit-module' module.id %}"> |
|||
<i class="fa fa-edit"></i> |
|||
</a> |
|||
{% acl_end %} |
|||
{% history_button module %} |
|||
{% can_delete module %} |
|||
<a class="btn btn-danger btn-sm" role="button" title={% trans "Delete" %} href="{% url 'topologie:del-module' module.id %}"> |
|||
<i class="fa fa-trash"></i> |
|||
</a> |
|||
{% acl_end %} |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
|
|||
{% if module_list.paginator %} |
|||
{% include "pagination.html" with list=module_list %} |
|||
{% endif %} |
|||
|
|||
@ -0,0 +1,43 @@ |
|||
{% extends "topologie/sidebar.html" %} |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
|
|||
{% load bootstrap3 %} |
|||
{% load acl %} |
|||
{% load i18n %} |
|||
|
|||
{% block title %}{% trans "Topology" %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h2>{% trans "Modules of switchs" %}</h2> |
|||
{% 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> |
|||
<hr> |
|||
{% acl_end %} |
|||
{% include "topologie/aff_modules.html" with module_list=module_list %} |
|||
<br /> |
|||
<br /> |
|||
<br /> |
|||
{% endblock %} |
|||
|
|||
Loading…
Reference in new issue