From 29f00f21cd0ff9877cc68505295ca5b54baa71be Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 8 Jul 2018 22:28:10 +0200 Subject: [PATCH] Stockage du firmware dans la bdd --- api/serializers.py | 2 +- .../migrations/0068_modelswitch_firmware.py | 20 +++++++++++++++++++ topologie/models.py | 5 +++++ .../templates/topologie/aff_model_switch.html | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 topologie/migrations/0068_modelswitch_firmware.py diff --git a/api/serializers.py b/api/serializers.py index 52902265..8bb0833e 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -717,7 +717,7 @@ class ProfilSerializer(NamespacedHMSerializer): class ModelSwitchSerializer(NamespacedHMSerializer): class Meta: model = topologie.ModelSwitch - fields = ('reference',) + fields = ('reference', 'firmware') class SwitchBaySerializer(NamespacedHMSerializer): diff --git a/topologie/migrations/0068_modelswitch_firmware.py b/topologie/migrations/0068_modelswitch_firmware.py new file mode 100644 index 00000000..8596f58f --- /dev/null +++ b/topologie/migrations/0068_modelswitch_firmware.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-07-08 19:56 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('topologie', '0067_auto_20180701_0016'), + ] + + operations = [ + migrations.AddField( + model_name='modelswitch', + name='firmware', + field=models.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/topologie/models.py b/topologie/models.py index 7ca285be..1c275026 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -320,6 +320,11 @@ class ModelSwitch(AclMixin, RevMixin, models.Model): 'topologie.ConstructorSwitch', on_delete=models.PROTECT ) + firmware = models.CharField( + max_length=255, + null=True, + blank=True + ) class Meta: permissions = ( diff --git a/topologie/templates/topologie/aff_model_switch.html b/topologie/templates/topologie/aff_model_switch.html index 6b3e7156..7fd1b37c 100644 --- a/topologie/templates/topologie/aff_model_switch.html +++ b/topologie/templates/topologie/aff_model_switch.html @@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Reference" as tr_ref %} {% include "buttons/sort.html" with prefix='model-switch' col='reference' text=tr_ref %} + Firmware {% trans "Switch constructor" as tr_constructor %} {% include "buttons/sort.html" with prefix='model-switch' col='constructor' text=tr_constructor %} @@ -43,6 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for model_switch in model_switch_list %} {{ model_switch.reference }} + {{model_switch.firmware}} {{ model_switch.constructor }} {% can_edit model_switch %} @@ -64,4 +66,6 @@ with this program; if not, write to the Free Software Foundation, Inc., {% if model_switch_list.paginator %} {% include "pagination.html" with list=model_switch_list %} {% endif %} + +