From f9358c5e960f0947aa099996f088da17b3861feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 9 Sep 2019 11:43:33 +0200 Subject: [PATCH] cards: do not disable card after duplication (#35934) --- tests/test_admin_pages.py | 8 ++++++++ wcs/backoffice/cards.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py index 4a3cb7348..7ecd1c2d9 100644 --- a/tests/test_admin_pages.py +++ b/tests/test_admin_pages.py @@ -5194,3 +5194,11 @@ def test_cards_new(pub, studio): assert '

card title' in resp.body assert CardDef.get(1).workflow_id is None assert CardDef.get(1).disabled is False + +def test_cards_duplicate(pub, studio): + test_cards_new(pub, studio) + app = login(get_app(pub)) + resp = app.get('http://example.net/backoffice/cards/1/') + resp = resp.click('Duplicate') + assert CardDef.get(2).name == 'card title (copy)' + assert CardDef.get(2).disabled is False diff --git a/wcs/backoffice/cards.py b/wcs/backoffice/cards.py index 56a4de3d6..bab1ce572 100644 --- a/wcs/backoffice/cards.py +++ b/wcs/backoffice/cards.py @@ -179,6 +179,12 @@ class CardDefPage(FormDefPage): r += htmltext('') return r.getvalue() + def duplicate(self): + response = super(CardDefPage, self).duplicate() + self.formdefui.formdef.disabled = False + self.formdefui.formdef.store() + return response + def get_sidebar(self): r = TemplateIO(html=True) r += htmltext('