diff options
author | Magnus Hagander | 2021-11-18 13:09:28 +0000 |
---|---|---|
committer | Magnus Hagander | 2021-11-18 13:21:42 +0000 |
commit | 5ae45b82676bfe2e6edc0c7e892221a39c33a943 (patch) | |
tree | ddb2ccc5767601ab29a50aaae7c184da36364de5 /pgweb/util/helpers.py | |
parent | 4708cd6fd83b253db2ef851bca56de81383a1cba (diff) |
Use separate title for save button for tristate moderation
When the save and submit steps are different, use "Save draft" for the
save button instead of "submit new" -- since the submit is a separate
step.
Diffstat (limited to 'pgweb/util/helpers.py')
-rw-r--r-- | pgweb/util/helpers.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pgweb/util/helpers.py b/pgweb/util/helpers.py index 2fa03722..7c6d7647 100644 --- a/pgweb/util/helpers.py +++ b/pgweb/util/helpers.py @@ -182,12 +182,25 @@ def simple_form(instancetype, itemid, request, formclass, formtemplate='base/for else: form_intro = None + savebutton = 'Save' + if itemid == 'new': + if 'modstate' in (f.name for f in instance._meta.get_fields()): + # This is a three-state moderated entry, so don't say "submit new" for new + savebutton = 'Save draft' + else: + savebutton = 'Submit New' + else: + # If it's a three-state moderated entry that is not yet approved, we are still editing the draft + if 'modstate' in (f.name for f in instance._meta.get_fields()): + if instance.modstate == ModerationState.CREATED: + savebutton = 'Save draft' + ctx = { 'form': form, 'formitemtype': instance._meta.verbose_name, 'form_intro': form_intro, 'described_checkboxes': getattr(form, 'described_checkboxes', {}), - 'savebutton': (itemid == "new") and "Submit New" or "Save", + 'savebutton': savebutton, 'operation': (itemid == "new") and "New" or "Edit", } ctx.update(extracontext) |