diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-30 19:59:16 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-30 19:59:37 +0100 |
commit | 6c1de61895bea26c3c219bbd57976396721dc073 (patch) | |
tree | dd60d5e07eeadd0d5172e81e0e762cd7f0d4f8b5 /ishtar_common | |
parent | f5f97fb1d89a4ccfc0219c17aa3e8bac6f7fd357 (diff) | |
download | Ishtar-6c1de61895bea26c3c219bbd57976396721dc073.tar.bz2 Ishtar-6c1de61895bea26c3c219bbd57976396721dc073.zip |
Basket: duplicate QA
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 9 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/forms/qa_base.html | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 219b6b266..b6c8fbb3d 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3495,9 +3495,10 @@ class Basket(FullSearch, OwnPerms): def get_write_query_owns(cls, ishtaruser): return Q(user=ishtaruser) - def duplicate(self, ishtaruser=None): + def duplicate(self, label=None, ishtaruser=None): """ Duplicate the basket. Items in basket are copied but not shared users + :param label: if provided use the name :param ishtaruser: if provided an alternate user is used :return: the new basket """ @@ -3506,13 +3507,15 @@ class Basket(FullSearch, OwnPerms): new_item.pk = None if ishtaruser: new_item.user = ishtaruser - label = new_item.label + if not label: + label = new_item.label while self.__class__.objects.filter( label=label, user=new_item.user).count(): label += unicode(_(u" - duplicate")) + new_item.label = label new_item.save() for item in items: - new_item.add(item) + new_item.items.add(item) return new_item diff --git a/ishtar_common/templates/ishtar/forms/qa_base.html b/ishtar_common/templates/ishtar/forms/qa_base.html index 70fe70e65..367acfcd8 100644 --- a/ishtar_common/templates/ishtar/forms/qa_base.html +++ b/ishtar_common/templates/ishtar/forms/qa_base.html @@ -1,7 +1,6 @@ {% load i18n inline_formset table_form %} -<div - class="modal-dialog {% if modal_size == 'large' %}modal-lg {% elif modal_size == 'small'%}modal-sm {% endif%}modal-dialog-centered"> +<div class="modal-dialog {% if modal_size == 'large' %}modal-lg {% elif modal_size == 'small'%}modal-sm {% endif%}modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h2>{{page_name|safe}}</h2> |