From 7527c5bea5b1910373a4b9204861f0a40bf6ba37 Mon Sep 17 00:00:00 2001 From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:33:48 +0300 Subject: [PATCH] Add maintainer field to plugin update --- qgis-app/plugins/forms.py | 14 ++++++++++++++ .../plugins/templates/plugins/plugin_form.html | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/qgis-app/plugins/forms.py b/qgis-app/plugins/forms.py index 8dabcf5f..fb673d42 100644 --- a/qgis-app/plugins/forms.py +++ b/qgis-app/plugins/forms.py @@ -43,10 +43,24 @@ class Meta: "tracker", "repository", "owners", + "created_by", "tags", "server", ) + def __init__(self, *args, **kwargs): + super(PluginForm, self).__init__(*args, **kwargs) + self.fields['owners'].label = "Collaborators" + + choices = ( + (self.instance.created_by.pk, self.instance.created_by.username + " (Plugin creator)"), + ) + for owner in self.instance.owners.exclude(pk=self.instance.created_by.pk): + choices += ((owner.pk, owner.username + " (Collaborator)"),) + + self.fields['created_by'].choices = choices + self.fields['created_by'].label = "Maintainer" + def clean(self): """ Check author diff --git a/qgis-app/plugins/templates/plugins/plugin_form.html b/qgis-app/plugins/templates/plugins/plugin_form.html index 4555a745..86edcd27 100644 --- a/qgis-app/plugins/templates/plugins/plugin_form.html +++ b/qgis-app/plugins/templates/plugins/plugin_form.html @@ -66,7 +66,7 @@