Compare commits

...

3 Commits

Author SHA1 Message Date
Mira Weller
9099a38bc8 Use shorter OrderPosition.code 2024-09-24 12:43:48 +02:00
Mira Weller
7cb66879ba Add inline "json_script" as supported data source for select2 2024-09-23 18:47:09 +02:00
Mira Weller
29808ad92d Add full_code property to OrderPosition 2024-09-23 18:47:09 +02:00
2 changed files with 18 additions and 0 deletions

View File

@@ -2835,6 +2835,14 @@ class OrderPosition(AbstractPosition):
(self.order.event.settings.change_allow_user_addons and ItemAddOn.objects.filter(base_item_id__in=[op.item_id for op in positions]).exists())
)
@property
def code(self):
"""
A ticket code which is unique among all events of a single organizer,
built by the order code and the position number.
"""
return '{order_code}-{position}'.format(order_code=self.order.code, position=self.positionid)
class Transaction(models.Model):
"""

View File

@@ -552,6 +552,16 @@ var form_handlers = function (el) {
language: $("body").attr("data-select2-locale"),
});
el.find('[data-model-select2=json_script]').each(function() {
const selectedValue = this.value;
this.replaceChildren();
$(this).select2({
theme: "bootstrap",
language: $("body").attr("data-select2-locale"),
data: JSON.parse($(this.getAttribute('data-select2-src')).text()),
}).val(selectedValue).trigger('change');
});
el.find('input[data-typeahead-url]').each(function () {
var $inp = $(this);
if ($inp.data("ttTypeahead") || $inp.hasClass("tt-hint")) {