Make names in community auth unique
authorMagnus Hagander <magnus@hagander.net>
Tue, 11 Apr 2023 15:30:29 +0000 (17:30 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 11 Apr 2023 15:31:50 +0000 (17:31 +0200)
Technically not needed for the system, but confusion is ensured if you
have two different sites with the same name...

pgweb/account/migrations/0009_cauth_unique_names.py [new file with mode: 0644]
pgweb/account/models.py
templates/docs/release_notes_list.html [new file with mode: 0644]

diff --git a/pgweb/account/migrations/0009_cauth_unique_names.py b/pgweb/account/migrations/0009_cauth_unique_names.py
new file mode 100644 (file)
index 0000000..9c77bc2
--- /dev/null
@@ -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),
+        ),
+    ]
index 0244a27e2ca25c155d116cd9a741b91a72107d9b..e3fa5feccedbb20efc8f02acf653d0163e33e901 100644 (file)
@@ -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)
diff --git a/templates/docs/release_notes_list.html b/templates/docs/release_notes_list.html
new file mode 100644 (file)
index 0000000..6cdb98c
--- /dev/null
@@ -0,0 +1,40 @@
+{% extends "base/page.html" %}
+{% load pgfilters %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup releases by major as release_groups %}
+
+<div id="release-notes" class="row">
+    <div class="col-md-9">
+      <section>
+        <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+      </section>
+      <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+      <ul class="release-notes-list fa-ul">
+        {% for release_group in release_groups %}
+          {% with major_version=release_group.grouper %}
+            <li>
+              <a class="collapsed" href="#release{{ major_version|cut:"." }}" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="release{{ major_version|cut:"." }}">
+                <span class="fa-li right"><i class="fas fa-angle-right"></i></span>
+                <span class="fa-li down"><i class="fas fa-angle-down"></i></span>
+                {% if major_version == 0 %}Postgres95{% else %}PostgreSQL {{ major_version | pg_major_version }}{% endif %}
+              </a>
+              <ul class="collapse release-notes-list" id="release{{ major_version|cut:"." }}">
+                {% for release in release_group.list %}
+                  <li>
+                    <a href="/docs/release/{{ major_version | pg_major_version }}.{{ release.minor | release_notes_pg_minor_version:major_version }}/">
+                      {{ major_version | pg_major_version }}.{{ release.minor | release_notes_pg_minor_version:major_version }}
+                    </a>
+                  </li>
+                {% endfor %}
+              </ul>
+            </li>
+          {% endwith %}
+        {% endfor %}
+      </ul>
+    </div>
+</div>
+
+{% endblock %}