mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add meta_data for items (#1576)
* PoC for ItemMetaProperties/Values * Missing is_valid * ItemMetaProperties/Values in editable via API, cloneable * Tests * Add Docs * Fix import order * Fix another import sorting... * Typeahead for ItemMetaValues * Test for editing event-objects * Fix typeahead permission checks * Further access restriction Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
This commit is contained in:
@@ -80,7 +80,10 @@ TEST_EVENT_RES = {
|
||||
'plugins': [
|
||||
'pretix.plugins.banktransfer',
|
||||
'pretix.plugins.ticketoutputpdf'
|
||||
]
|
||||
],
|
||||
'item_meta_properties': {
|
||||
'day': 'Monday',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -507,6 +510,35 @@ def test_event_update(token_client, organizer, event, item, meta_prop):
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"meta_data":["Meta data property \'test\' does not exist."]}'
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/events/{}/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"item_meta_properties": {
|
||||
"Foo": "Bar"
|
||||
}
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
with scopes_disabled():
|
||||
assert organizer.events.get(slug=resp.data['slug']).item_meta_properties.filter(
|
||||
name="Foo", default="Bar"
|
||||
).exists()
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/events/{}/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"item_meta_properties": {
|
||||
}
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
with scopes_disabled():
|
||||
assert not organizer.events.get(slug=resp.data['slug']).item_meta_properties.filter(
|
||||
name="Foo"
|
||||
).exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_event_test_mode(token_client, organizer, event):
|
||||
|
||||
Reference in New Issue
Block a user