forked from CGM_Public/pretix_original
Public event filter: Make "all" option clearer (Z#23169843) (#4585)
* Public event filter: Make "all" option clearer * Fix widget tests * Update src/tests/presale/test_widget.py Co-authored-by: Richard Schreiber <schreiber@rami.io> --------- Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.utils.translation import pgettext
|
||||
from i18nfield.strings import LazyI18nString
|
||||
|
||||
from pretix.base.models import EventMetaValue, SubEventMetaValue
|
||||
@@ -66,7 +67,7 @@ def meta_filtersets(organizer, event=None):
|
||||
).values_list("value", flat=True).distinct())
|
||||
choices = [(k, k) for k in sorted(existing_values)]
|
||||
|
||||
choices.insert(0, ("", ""))
|
||||
choices.insert(0, ("", "-- %s --" % pgettext("filter_empty", "all")))
|
||||
if len(choices) > 1:
|
||||
fields[f"attr[{prop.name}]"] = {
|
||||
"label": str(prop.public_label) or prop.name,
|
||||
|
||||
@@ -812,7 +812,7 @@ class WidgetCartTest(CartTestMixin, TestCase):
|
||||
data = json.loads(response.content.decode())
|
||||
assert data["meta_filter_fields"] == [
|
||||
{
|
||||
"choices": [["", ""], ["EN", "English"], ["DE", "German"]],
|
||||
"choices": [["", "-- all --"], ["EN", "English"], ["DE", "German"]],
|
||||
"key": "attr[Language]",
|
||||
"label": "Language"
|
||||
}
|
||||
@@ -838,7 +838,7 @@ class WidgetCartTest(CartTestMixin, TestCase):
|
||||
data = json.loads(response.content.decode())
|
||||
assert data["meta_filter_fields"] == [
|
||||
{
|
||||
"choices": [["", ""], ["DE", "DE"], ["EN", "EN"]],
|
||||
"choices": [["", "-- all --"], ["DE", "DE"], ["EN", "EN"]],
|
||||
"key": "attr[Language]",
|
||||
"label": "Language"
|
||||
}
|
||||
@@ -848,7 +848,7 @@ class WidgetCartTest(CartTestMixin, TestCase):
|
||||
data = json.loads(response.content.decode())
|
||||
assert data["meta_filter_fields"] == [
|
||||
{
|
||||
"choices": [["", ""], ["DE", "DE"]],
|
||||
"choices": [["", "-- all --"], ["DE", "DE"]],
|
||||
"key": "attr[Language]",
|
||||
"label": "Language"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user