mirror of
https://github.com/pretix/pretix.git
synced 2026-01-14 23:02:26 +00:00
Compare commits
1 Commits
it-aosta
...
fix-api-ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba7d4ec13c |
@@ -966,6 +966,7 @@ class CheckinRPCSearchView(ListAPIView):
|
||||
def get_serializer_context(self):
|
||||
ctx = super().get_serializer_context()
|
||||
ctx['expand'] = self.request.query_params.getlist('expand')
|
||||
ctx['organizer'] = self.request.organizer
|
||||
ctx['pdf_data'] = False
|
||||
return ctx
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ from pretix.base.validators import multimail_validate
|
||||
from pretix.control.forms import (
|
||||
ExtFileField, FontSelect, MultipleLanguagesWidget, SingleLanguageWidget,
|
||||
)
|
||||
from pretix.helpers.countries import CachedCountries, pycountry_add
|
||||
from pretix.helpers.countries import CachedCountries
|
||||
|
||||
ROUNDING_MODES = (
|
||||
('line', _('Compute taxes for every line individually')),
|
||||
@@ -3914,7 +3914,7 @@ COUNTRIES_WITH_STATE_IN_ADDRESS = {
|
||||
'MX': (['State', 'Federal district', 'Federal entity'], 'short'),
|
||||
'US': (['State', 'Outlying area', 'District'], 'short'),
|
||||
'IT': (['Province', 'Free municipal consortium', 'Metropolitan city', 'Autonomous province',
|
||||
'Decentralized regional entity'], 'short'),
|
||||
'Free municipal consortium', 'Decentralized regional entity'], 'short'),
|
||||
}
|
||||
COUNTRY_STATE_LABEL = {
|
||||
# Countries in which the "State" field should not be called "State"
|
||||
@@ -3922,8 +3922,6 @@ COUNTRY_STATE_LABEL = {
|
||||
'JP': pgettext_lazy('address', 'Prefecture'),
|
||||
'IT': pgettext_lazy('address', 'Province'),
|
||||
}
|
||||
# Workaround for https://github.com/pretix/pretix/issues/5796
|
||||
pycountry_add(pycountry.subdivisions, code="IT-AO", country_code="IT", name="Valle d'Aosta", parent="23", parent_code="IT-23", type="Province")
|
||||
|
||||
settings_hierarkey = Hierarkey(attribute_name='settings')
|
||||
|
||||
|
||||
@@ -136,16 +136,3 @@ custom_translations = [
|
||||
gettext_noop("North Macedonia"),
|
||||
gettext_noop("Macao"),
|
||||
]
|
||||
|
||||
|
||||
def pycountry_add(db, **kw):
|
||||
# Workaround for https://github.com/pycountry/pycountry/issues/281
|
||||
db._load()
|
||||
obj = db.factory(**kw)
|
||||
db.objects.append(obj)
|
||||
for key, value in kw.items():
|
||||
if key in db.no_index:
|
||||
continue
|
||||
value = value.lower()
|
||||
index = db.indices.setdefault(key, {})
|
||||
index.setdefault(value, set()).add(obj)
|
||||
|
||||
@@ -932,6 +932,12 @@ def test_search(token_client, organizer, event, clist, clist_all, item, other_it
|
||||
assert resp.status_code == 200
|
||||
assert [p1] == resp.data['results']
|
||||
|
||||
with django_assert_max_num_queries(25):
|
||||
resp = token_client.get(
|
||||
'/api/v1/organizers/{}/checkinrpc/search/?list={}&search=z3fsn8jyu&expand=item'.format(organizer.slug, clist_all.pk))
|
||||
assert resp.status_code == 200
|
||||
assert resp.data['results'][0]['item']['name']
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_no_list(token_client, organizer, event, clist, clist_all, item, other_item, order):
|
||||
|
||||
Reference in New Issue
Block a user