Skip to content

Commit ed8b429

Browse files
authored
fix(500): item to product renames (#1350)
1 parent b0d2953 commit ed8b429

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

app/eventyay/base/exporters/json.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,30 @@ def render(self, form_data):
3131
}
3232
for category in self.event.categories.all()
3333
],
34-
'items': [
34+
'products': [
3535
{
36-
'id': item.id,
37-
'name': str(item.name),
38-
'internal_name': str(item.internal_name),
39-
'category': item.category_id,
40-
'price': item.default_price,
41-
'tax_rate': item.tax_rule.rate if item.tax_rule else Decimal('0.00'),
42-
'tax_name': str(item.tax_rule.name) if item.tax_rule else None,
43-
'admission': item.admission,
44-
'active': item.active,
36+
'id': product.id,
37+
'name': str(product.name),
38+
'internal_name': str(product.internal_name),
39+
'category': product.category_id,
40+
'price': product.default_price,
41+
'tax_rate': product.tax_rule.rate if product.tax_rule else Decimal('0.00'),
42+
'tax_name': str(product.tax_rule.name) if product.tax_rule else None,
43+
'admission': product.admission,
44+
'active': product.active,
4545
'variations': [
4646
{
4747
'id': variation.id,
4848
'active': variation.active,
4949
'price': variation.default_price
5050
if variation.default_price is not None
51-
else item.default_price,
51+
else product.default_price,
5252
'name': str(variation),
5353
}
54-
for variation in item.variations.all()
54+
for variation in product.variations.all()
5555
],
5656
}
57-
for item in self.event.items.select_related('tax_rule').prefetch_related('variations')
57+
for product in self.event.products.select_related('tax_rule').prefetch_related('variations')
5858
],
5959
'questions': [
6060
{
@@ -83,7 +83,7 @@ def render(self, form_data):
8383
'positions': [
8484
{
8585
'id': position.id,
86-
'item': position.item_id,
86+
'product': position.product_id,
8787
'variation': position.variation_id,
8888
'price': position.price,
8989
'attendee_name': position.attendee_name,
@@ -107,10 +107,10 @@ def render(self, form_data):
107107
{
108108
'id': quota.id,
109109
'size': quota.size,
110-
'items': [item.id for item in quota.items.all()],
110+
'products': [product.id for product in quota.products.all()],
111111
'variations': [variation.id for variation in quota.variations.all()],
112112
}
113-
for quota in self.event.quotas.all().prefetch_related('items', 'variations')
113+
for quota in self.event.quotas.all().prefetch_related('products', 'variations')
114114
],
115115
}
116116
}

app/eventyay/base/models/tax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def allow_delete(self):
173173
return (
174174
not OrderFee.objects.filter(tax_rule=self, order__event=self.event).exists()
175175
and not OrderPosition.all.filter(tax_rule=self, order__event=self.event).exists()
176-
and not self.event.items.filter(tax_rule=self).exists()
176+
and not self.event.products.filter(tax_rule=self).exists()
177177
and self.event.settings.tax_rate_default != self
178178
)
179179

app/eventyay/base/services/cancelevent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ def cancel_event(
210210
user=user,
211211
)
212212

213-
for i in event.items.filter(active=True):
213+
for i in event.products.filter(active=True):
214214
i.active = False
215215
i.save(update_fields=['active'])
216216
i.log_action(
217-
'pretix.event.item.changed',
217+
'pretix.event.product.changed',
218218
user=user,
219219
data={'active': False, '_source': 'cancel_event'},
220220
)

app/eventyay/control/forms/checkin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, **kwargs):
4444
self.event = kwargs.pop('event')
4545
kwargs.pop('locales', None)
4646
super().__init__(**kwargs)
47-
self.fields['limit_products'].queryset = self.event.items.all()
47+
self.fields['limit_products'].queryset = self.event.products.all()
4848
self.fields['auto_checkin_sales_channels'] = forms.MultipleChoiceField(
4949
label=self.fields['auto_checkin_sales_channels'].label,
5050
help_text=self.fields['auto_checkin_sales_channels'].help_text,
@@ -117,7 +117,7 @@ def __init__(self, **kwargs):
117117
self.event = kwargs.pop('event')
118118
kwargs.pop('locales', None)
119119
super().__init__(**kwargs)
120-
self.fields['limit_products'].queryset = self.event.items.all()
120+
self.fields['limit_products'].queryset = self.event.products.all()
121121

122122
if not self.event.organizer.gates.exists():
123123
del self.fields['gates']

app/eventyay/control/views/pdf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ def process_upload(self):
6262
return None, f
6363

6464
def _get_preview_position(self):
65-
item = self.request.event.items.create(
65+
product = self.request.event.products.create(
6666
name=_('Sample product'),
6767
default_price=42.23,
6868
description=_('Sample product description'),
6969
)
70-
item2 = self.request.event.items.create(name=_('Sample workshop'), default_price=23.40)
70+
product2 = self.request.event.products.create(name=_('Sample workshop'), default_price=23.40)
7171

7272
from pretix.base.models import Order
7373

@@ -83,9 +83,9 @@ def _get_preview_position(self):
8383

8484
scheme = PERSON_NAME_SCHEMES[self.request.event.settings.name_scheme]
8585
sample = {k: str(v) for k, v in scheme['sample'].items()}
86-
p = order.positions.create(item=item, attendee_name_parts=sample, price=item.default_price)
87-
order.positions.create(item=item2, attendee_name_parts=sample, price=item.default_price, addon_to=p)
88-
order.positions.create(item=item2, attendee_name_parts=sample, price=item.default_price, addon_to=p)
86+
p = order.positions.create(product=product, attendee_name_parts=sample, price=product.default_price)
87+
order.positions.create(product=product2, attendee_name_parts=sample, price=product.default_price, addon_to=p)
88+
order.positions.create(product=product2, attendee_name_parts=sample, price=product.default_price, addon_to=p)
8989

9090
InvoiceAddress.objects.create(order=order, name_parts=sample, company=_('Sample company'))
9191
return p

app/eventyay/eventyay_common/templates/eventyay_common/event/settings_base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h2>{% trans "Congratulations!" %}</h2>
1818
{% endblocktrans %}
1919
</p>
2020
<p>
21-
<a href="{% url "control:event.items.add" organizer=request.organizer.slug event=request.event.slug %}"
21+
<a href="{% url "control:event.products.add" organizer=request.organizer.slug event=request.event.slug %}"
2222
class="btn btn-default">
2323
{% trans "Create a first product" %}
2424
</a>

app/eventyay/eventyay_common/templates/eventyay_common/events/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h3 class="panel-title">{% trans "Filter" %}</h3>
127127
{% include "pretixcontrol/fragment_quota_box_paid.html" with quota=q %}
128128
{% endfor %}
129129
{% if e.first_quotas|length > 3 %}
130-
<a href="{% url 'control:event.items.quotas' organizer=e.organizer.slug event=e.slug %}"
130+
<a href="{% url 'control:event.products.quotas' organizer=e.organizer.slug event=e.slug %}"
131131
class="quotabox-more" data-toggle="tooltip" title="{% trans 'More quotas' %}"
132132
aria-label="{% trans 'More quotas' %}" data-placement="top">
133133
&middot;&middot;&middot;

0 commit comments

Comments
 (0)