From 2d2b2d08f4aae0e4ba896aa37abb191316e3dc26 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 9 Jul 2020 22:57:27 +0200 Subject: [PATCH] core: fix source slug not being unique --- .../migrations/0006_auto_20200709_1608.py | 20 ++++++++++ passbook/core/models.py | 4 +- .../migrations/0005_auto_20200709_1608.py | 39 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 passbook/core/migrations/0006_auto_20200709_1608.py create mode 100644 passbook/stages/prompt/migrations/0005_auto_20200709_1608.py diff --git a/passbook/core/migrations/0006_auto_20200709_1608.py b/passbook/core/migrations/0006_auto_20200709_1608.py new file mode 100644 index 000000000..527b3aa45 --- /dev/null +++ b/passbook/core/migrations/0006_auto_20200709_1608.py @@ -0,0 +1,20 @@ +# Generated by Django 3.0.8 on 2020-07-09 16:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_core", "0005_token_intent"), + ] + + operations = [ + migrations.AlterField( + model_name="source", + name="slug", + field=models.SlugField( + help_text="Internal source name, used in URLs.", unique=True + ), + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index ffe0386c4..2b692d64d 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -134,7 +134,9 @@ class Source(PolicyBindingModel): """Base Authentication source, i.e. an OAuth Provider, SAML Remote or LDAP Server""" name = models.TextField(help_text=_("Source's display Name.")) - slug = models.SlugField(help_text=_("Internal source name, used in URLs.")) + slug = models.SlugField( + help_text=_("Internal source name, used in URLs."), unique=True + ) enabled = models.BooleanField(default=True) property_mappings = models.ManyToManyField( diff --git a/passbook/stages/prompt/migrations/0005_auto_20200709_1608.py b/passbook/stages/prompt/migrations/0005_auto_20200709_1608.py new file mode 100644 index 000000000..35c61d89a --- /dev/null +++ b/passbook/stages/prompt/migrations/0005_auto_20200709_1608.py @@ -0,0 +1,39 @@ +# Generated by Django 3.0.8 on 2020-07-09 16:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_stages_prompt", "0004_auto_20200618_1735"), + ] + + operations = [ + migrations.AlterField( + model_name="prompt", + name="type", + field=models.CharField( + choices=[ + ("text", "Text: Simple Text input"), + ( + "username", + "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ), + ("email", "Email: Text field with Email type."), + ("password", "Password"), + ("number", "Number"), + ("checkbox", "Checkbox"), + ("data", "Date"), + ("data-time", "Date Time"), + ("separator", "Separator: Static Separator Line"), + ( + "hidden", + "Hidden: Hidden field, can be used to insert data into form.", + ), + ("static", "Static: Static value, displayed as-is."), + ], + max_length=100, + ), + ), + ]