diff --git a/zezere/default.conf b/zezere/default.conf index 78fc39f..42bf231 100644 --- a/zezere/default.conf +++ b/zezere/default.conf @@ -4,7 +4,6 @@ debug = no allowed_hosts = localhost, localhost.localdomain secure_cookie = yes # auth_method = local, oidc -# ov_base_url = [oidc.rp] # client_id = diff --git a/zezere/migrations/0013_alter_device_mac_address.py b/zezere/migrations/0013_alter_device_mac_address.py new file mode 100644 index 0000000..fd55ac6 --- /dev/null +++ b/zezere/migrations/0013_alter_device_mac_address.py @@ -0,0 +1,20 @@ +# Generated by Django 4.0.4 on 2022-04-20 06:28 + +import django.core.validators +from django.db import migrations, models +import zezere.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('zezere', '0012_auto_20200323_1130'), + ] + + operations = [ + migrations.AlterField( + model_name='device', + name='mac_address', + field=models.CharField(max_length=20, unique=True, validators=[django.core.validators.RegexValidator('^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$'), zezere.models.validator_disallow_blacklisted_mac], verbose_name='Device MAC Address'), + ), + ] diff --git a/zezere/migrations/0014_config.py b/zezere/migrations/0014_config.py new file mode 100644 index 0000000..ac2a343 --- /dev/null +++ b/zezere/migrations/0014_config.py @@ -0,0 +1,25 @@ +# Generated by Django 4.0.4 on 2022-08-14 06:22 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('zezere', '0013_alter_device_mac_address'), + ] + + operations = [ + migrations.CreateModel( + name='Config', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('auth_token', models.CharField(default='', max_length=255)), + ('ov_base_url', models.URLField(default='', max_length=255)), + ('owner', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/zezere/models.py b/zezere/models.py index 731113d..1026126 100644 --- a/zezere/models.py +++ b/zezere/models.py @@ -208,3 +208,14 @@ class UnownedDeviceSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Device fields = ["mac_address"] + + +class Config(models.Model): + owner = models.ForeignKey( + User, on_delete=models.PROTECT, default=None, blank=True, null=True + ) + auth_token = models.CharField(max_length=255, default="") + ov_base_url = models.URLField(max_length=255, default="") + + def __str__(self): + return "configuration for %s" % self.owner diff --git a/zezere/settings.py b/zezere/settings.py index b42b882..202197b 100644 --- a/zezere/settings.py +++ b/zezere/settings.py @@ -170,5 +170,3 @@ messages.WARNING: "alert-warning", messages.ERROR: "alert-danger", } - -OV_BASE_URL = get("global", "ov_base_url", "OV_BASE_URL") diff --git a/zezere/templates/portal/configure.html b/zezere/templates/portal/configure.html new file mode 100644 index 0000000..6dabc41 --- /dev/null +++ b/zezere/templates/portal/configure.html @@ -0,0 +1,25 @@ +{% extends "./master.html" %} + +{% load rules %} + +{% block title %}Add Voucher{% endblock %} + +{% block content %} + +{% if messages %} + {% for message in messages %} +
+ {% endfor %} +{% endif %} + +