From 33e1d1fa6ba5b089b54fc3f04d10c668e2b29fc7 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, 29 insertions(+), 2 deletions(-) create mode 100644 topologie/migrations/0068_modelswitch_firmware.py diff --git a/api/serializers.py b/api/serializers.py index c72c03de..a99603fc 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -691,7 +691,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 27952a4e..b11374c6 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -299,6 +299,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 6bb3e1f0..326a1034 100644 --- a/topologie/templates/topologie/aff_model_switch.html +++ b/topologie/templates/topologie/aff_model_switch.html @@ -32,13 +32,15 @@ with this program; if not, write to the Free Software Foundation, Inc., {% include "buttons/sort.html" with prefix='model-switch' col='reference' text='Référence' %} - {% include "buttons/sort.html" with prefix='model-switch' col='constructor' text='Constructeur' %} + Firmware + {% include "buttons/sort.html" with prefix='model-switch' col='constructor' text='Constructeur' %} {% for model_switch in model_switch_list %} {{model_switch.reference}} + {{model_switch.firmware}} {{model_switch.constructor}}