summaryrefslogtreecommitdiff
path: root/pgweb
diff options
context:
space:
mode:
authorMagnus Hagander2023-04-11 15:30:29 +0000
committerMagnus Hagander2023-04-11 15:31:50 +0000
commit19682de806b9a340b864d1b0738d4f23f6bd2a24 (patch)
tree13d806f6180757c6e5e1158b2c92bca7d78250c3 /pgweb
parent8c289fe90db108b089aa70b5ff834c67648d87e3 (diff)
Make names in community auth unique
Technically not needed for the system, but confusion is ensured if you have two different sites with the same name...
Diffstat (limited to 'pgweb')
-rw-r--r--pgweb/account/migrations/0009_cauth_unique_names.py23
-rw-r--r--pgweb/account/models.py4
2 files changed, 25 insertions, 2 deletions
diff --git a/pgweb/account/migrations/0009_cauth_unique_names.py b/pgweb/account/migrations/0009_cauth_unique_names.py
new file mode 100644
index 00000000..9c77bc20
--- /dev/null
+++ b/pgweb/account/migrations/0009_cauth_unique_names.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.2.14 on 2023-04-11 15:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0008_cooloff_message'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='communityauthorg',
+ name='orgname',
+ field=models.CharField(help_text='Name of the organisation', max_length=100, unique=True),
+ ),
+ migrations.AlterField(
+ model_name='communityauthsite',
+ name='name',
+ field=models.CharField(help_text="Note that the value in this field is shown on the login page, so make sure it's user-friendly!", max_length=100, unique=True),
+ ),
+ ]
diff --git a/pgweb/account/models.py b/pgweb/account/models.py
index 0244a27e..e3fa5fec 100644
--- a/pgweb/account/models.py
+++ b/pgweb/account/models.py
@@ -3,7 +3,7 @@ from django.contrib.auth.models import User
class CommunityAuthOrg(models.Model):
- orgname = models.CharField(max_length=100, null=False, blank=False,
+ orgname = models.CharField(max_length=100, null=False, blank=False, unique=True,
help_text="Name of the organisation")
require_consent = models.BooleanField(null=False, blank=False, default=True)
@@ -12,7 +12,7 @@ class CommunityAuthOrg(models.Model):
class CommunityAuthSite(models.Model):
- name = models.CharField(max_length=100, null=False, blank=False,
+ name = models.CharField(max_length=100, null=False, blank=False, unique=True,
help_text="Note that the value in this field is shown on the login page, so make sure it's user-friendly!")
redirecturl = models.URLField(max_length=200, null=False, blank=False)
apiurl = models.URLField(max_length=200, null=False, blank=True)