From da929654c034bee40babcdac7ed6fdb007a81b47 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 23 Jun 2024 10:06:47 +0200 Subject: [PATCH] feat: add suffix approval workflow in admin UI Introduced a suffix approval workflow, allowing admins to manage pending suffixes via a new approval form and pending suffix list view. Added the ability to mark suffixes as approved, updating multiple templates and views accordingly. Ensured only the relevant suffixes appear in lists based on user permissions and approval status. - Added SuffixApprovalForm for approval actions. - Created migration to add description field to the Suffix model. - Updated navigation links and templates to reflect user-specific data. - Implemented views for pending suffixes and suffix approval. This enhancement improves the admin experience by providing streamlined management of suffix approvals. --- freedoi/resolver/forms.py | 6 +++ .../migrations/0007_suffix_description.py | 18 ++++++++ freedoi/resolver/templates/base_generic.html | 8 +--- .../resolver/pending_suffixes_list.html | 13 ++++++ .../resolver/suffix_approval_form.html | 13 ++++++ .../templates/resolver/suffix_detail.html | 5 ++- .../templates/resolver/suffix_list.html | 2 +- freedoi/resolver/urls.py | 42 +++++++++++++------ freedoi/resolver/views.py | 33 ++++++++++++++- 9 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 freedoi/resolver/migrations/0007_suffix_description.py create mode 100644 freedoi/resolver/templates/resolver/pending_suffixes_list.html create mode 100644 freedoi/resolver/templates/resolver/suffix_approval_form.html diff --git a/freedoi/resolver/forms.py b/freedoi/resolver/forms.py index 629c0e1..822355c 100644 --- a/freedoi/resolver/forms.py +++ b/freedoi/resolver/forms.py @@ -33,6 +33,12 @@ class SuffixForm(forms.ModelForm): self.fields["prefix"].widget.attrs["readonly"] = True +class SuffixApprovalForm(forms.ModelForm): + class Meta: + model = Suffix + fields = ["name", "suffix", "description"] + + class IdentifierForm(forms.ModelForm): class Meta: model = Identifier diff --git a/freedoi/resolver/migrations/0007_suffix_description.py b/freedoi/resolver/migrations/0007_suffix_description.py new file mode 100644 index 0000000..5ff50f5 --- /dev/null +++ b/freedoi/resolver/migrations/0007_suffix_description.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.6 on 2024-06-23 08:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("resolver", "0006_alter_suffix_options_alter_prefix_owner_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="suffix", + name="description", + field=models.TextField(blank=True), + ), + ] diff --git a/freedoi/resolver/templates/base_generic.html b/freedoi/resolver/templates/base_generic.html index 8a12f72..f68899f 100644 --- a/freedoi/resolver/templates/base_generic.html +++ b/freedoi/resolver/templates/base_generic.html @@ -34,16 +34,12 @@ {% if user.is_authenticated %} {% if user.is_superuser or user.prefixes.exists %} {% endif %} -