From 000d64adf001baab5e9d07e0688d6056fb7142d6 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 4 Sep 2020 19:54:46 +0200 Subject: [PATCH] =?UTF-8?q?L'=C3=A9dition=20des=20r=C3=A9glages=20de=20mul?= =?UTF-8?q?ti=5Fop=20fonctionne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0003_auto_20200904_1938.py | 20 +++++++++++++++++++ multi_op/preferences/models.py | 6 ++++-- multi_op/templates/multi_op/preferences.html | 19 ++++++++---------- 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 multi_op/migrations/0003_auto_20200904_1938.py diff --git a/multi_op/migrations/0003_auto_20200904_1938.py b/multi_op/migrations/0003_auto_20200904_1938.py new file mode 100644 index 00000000..de4e6b82 --- /dev/null +++ b/multi_op/migrations/0003_auto_20200904_1938.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2020-09-04 17:38 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('multi_op', '0002_auto_20200904_1905'), + ] + + operations = [ + migrations.AlterField( + model_name='multiopoption', + name='enabled_dorm', + field=models.ManyToManyField(blank=True, related_name='enabled_dorm_multiop', to='topologie.Dormitory', verbose_name='enabled dorm'), + ), + ] diff --git a/multi_op/preferences/models.py b/multi_op/preferences/models.py index 8a185188..7d5e3d3a 100644 --- a/multi_op/preferences/models.py +++ b/multi_op/preferences/models.py @@ -27,13 +27,15 @@ with multiple operators. from django.db import models from django.utils.translation import ugettext_lazy as _ +from re2o.mixins import AclMixin, RevMixin +from preferences.models import PreferencesModel -class Preferences(models.Model): +class MultiopOption(AclMixin, PreferencesModel): """Definition of the settings of multi_op.""" enabled_dorm = models.ManyToManyField( "topologie.Dormitory", - related_name="vlan_tagged", + related_name="enabled_dorm_multiop", blank=True, verbose_name=_("enabled dorm"), ) diff --git a/multi_op/templates/multi_op/preferences.html b/multi_op/templates/multi_op/preferences.html index 391b7330..5529dbe3 100644 --- a/multi_op/templates/multi_op/preferences.html +++ b/multi_op/templates/multi_op/preferences.html @@ -8,23 +8,20 @@ -
- {% comment %} - +
+ {% trans "Edit" %} -

- {% endcomment %} +

- - - - -

{% trans "Enabled Dorm" %}

{{ preferences.enabled_dorm | tick}}

-
+ +

{% trans "Enabled Dorm" %}

+

{{ preferences.enabled_dorm.all|join:", " }}

+ +