diff options
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> |