migration, show category type in ui

This commit is contained in:
Mira Weller
2024-05-28 19:50:28 +02:00
parent a0d865cf4f
commit 97925e2d77
3 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# Generated by Django 4.2.11 on 2024-05-27 13:19
from django.db import migrations, models
import pretix.base.models.orders
class Migration(migrations.Migration):
dependencies = [
("pretixbase", "0264_order_internal_secret"),
]
operations = [
migrations.AddField(
model_name="itemcategory",
name="cross_selling_condition",
field=models.CharField(null=True),
),
migrations.AddField(
model_name="itemcategory",
name="cross_selling_mode",
field=models.CharField(null=True),
),
migrations.AddField(
model_name="itemcategory",
name="cross_selling_match_products",
field=models.ManyToManyField(
related_name="matched_by_cross_selling_categories", to="pretixbase.item"
),
),
]

View File

@@ -158,6 +158,8 @@ class ItemCategory(LoggedModel):
name = self.internal_name or self.name
if self.is_addon:
return _('{category} (Add-On products)').format(category=str(name))
if self.cross_selling_mode is not None:
return _('{category} ({category_type})').format(category=str(name), category_type=self.get_cross_selling_mode_display())
return str(name)
def get_category_type_display(self):