mirror of
https://github.com/pretix/pretix.git
synced 2026-08-13 11:17:01 +00:00
API: Fix setting plugins during event creation
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
# License for the specific language governing permissions and limitations under the License.
|
||||
|
||||
import django_filters
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Prefetch, ProtectedError, Q
|
||||
from django.utils.timezone import now
|
||||
@@ -250,7 +251,7 @@ class EventViewSet(viewsets.ModelViewSet):
|
||||
if copy_from:
|
||||
new_event.copy_data_from(copy_from)
|
||||
|
||||
if plugins:
|
||||
if plugins is not None:
|
||||
new_event.set_active_plugins(plugins)
|
||||
if 'is_public' in serializer.validated_data:
|
||||
new_event.is_public = serializer.validated_data['is_public']
|
||||
@@ -266,9 +267,8 @@ class EventViewSet(viewsets.ModelViewSet):
|
||||
else:
|
||||
serializer.instance.set_defaults()
|
||||
|
||||
if plugins:
|
||||
new_event.set_active_plugins(plugins)
|
||||
new_event.save(update_fields=['plugins'])
|
||||
new_event.set_active_plugins(plugins if plugins is not None else settings.PRETIX_PLUGINS_DEFAULT.split(','))
|
||||
new_event.save(update_fields=['plugins'])
|
||||
|
||||
serializer.instance.log_action(
|
||||
'pretix.event.added',
|
||||
|
||||
@@ -438,7 +438,7 @@ def test_event_create_with_clone(token_client, organizer, event, meta_prop, urls
|
||||
assert resp.status_code == 201
|
||||
with scopes_disabled():
|
||||
cloned_event = Event.objects.get(organizer=organizer.pk, slug='2031')
|
||||
assert cloned_event.plugins == "pretix.plugins.banktransfer,pretix.plugins.ticketoutputpdf"
|
||||
assert cloned_event.plugins == event.plugins
|
||||
assert cloned_event.is_public is True
|
||||
assert organizer.events.get(slug="2031").meta_values.filter(
|
||||
property__name=meta_prop.name, value="Conference"
|
||||
|
||||
Reference in New Issue
Block a user