From 7095ce60bece161f942a88e32ea4c55bba3ff875 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Date: Wed, 9 Jan 2019 17:08:39 +0100 Subject: [PATCH] Only display WiFi selection in device editor if device model supports WWAN --- manager/migrations/0031_auto_20190109_1559.py | 23 +++++++++++++++++++ manager/models.py | 1 + manager/templates/manager/edit.html | 20 ++++++++-------- 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 manager/migrations/0031_auto_20190109_1559.py diff --git a/manager/migrations/0031_auto_20190109_1559.py b/manager/migrations/0031_auto_20190109_1559.py new file mode 100644 index 0000000..cd7343a --- /dev/null +++ b/manager/migrations/0031_auto_20190109_1559.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.3 on 2019-01-09 15:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('manager', '0030_auto_20190103_1823'), + ] + + operations = [ + migrations.AddField( + model_name='model', + name='wwan', + field=models.BooleanField(default=False, verbose_name='Supports WWAN (External WiFi)'), + ), + migrations.AlterField( + model_name='device', + name='wifi', + field=models.ManyToManyField(blank=True, to='manager.Wifi'), + ), + ] diff --git a/manager/models.py b/manager/models.py index 8c74e65..b28d22a 100644 --- a/manager/models.py +++ b/manager/models.py @@ -26,6 +26,7 @@ class Model(models.Model): extname = models.CharField("Manufacturer Model Name", max_length=100) config = models.TextField("OpenWRT Compile Config", blank=True, null=True) firmware = models.DateTimeField("Firmware Modification Date", auto_now=True) + wwan = models.BooleanField("Supports WWAN (External WiFi)", default=False) def __str__(self): return self.name diff --git a/manager/templates/manager/edit.html b/manager/templates/manager/edit.html index f0056f2..1794ddb 100644 --- a/manager/templates/manager/edit.html +++ b/manager/templates/manager/edit.html @@ -39,15 +39,17 @@ A network change will require a reboot of the device to be applied. -
- - - This feature is not yet available on all devices. -
+ {% if device.model.wwan %} +
+ + + This feature is not yet available on all devices. +
+ {% endif %}