forked from CGM_Public/pretix_original
Fix #372 -- Plugin hook for "Copy from event"
This commit is contained in:
@@ -11,7 +11,7 @@ Core
|
|||||||
----
|
----
|
||||||
|
|
||||||
.. automodule:: pretix.base.signals
|
.. automodule:: pretix.base.signals
|
||||||
:members: periodic_task, event_live_issues
|
:members: periodic_task, event_live_issues, event_copy_data
|
||||||
|
|
||||||
Order events
|
Order events
|
||||||
""""""""""""
|
""""""""""""
|
||||||
|
|||||||
@@ -226,6 +226,8 @@ class Event(LoggedModel):
|
|||||||
|
|
||||||
def copy_data_from(self, other):
|
def copy_data_from(self, other):
|
||||||
from . import ItemAddOn, ItemCategory, Item, Question, Quota
|
from . import ItemAddOn, ItemCategory, Item, Question, Quota
|
||||||
|
from ..signals import event_copy_data
|
||||||
|
|
||||||
self.plugins = other.plugins
|
self.plugins = other.plugins
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
@@ -297,6 +299,8 @@ class Event(LoggedModel):
|
|||||||
s.value = 'file://' + newname
|
s.value = 'file://' + newname
|
||||||
s.save()
|
s.save()
|
||||||
|
|
||||||
|
event_copy_data.send(sender=self, other=other)
|
||||||
|
|
||||||
|
|
||||||
def generate_invite_token():
|
def generate_invite_token():
|
||||||
return get_random_string(length=32, allowed_chars=string.ascii_lowercase + string.digits)
|
return get_random_string(length=32, allowed_chars=string.ascii_lowercase + string.digits)
|
||||||
|
|||||||
@@ -153,6 +153,21 @@ to the user. The receivers are expected to return HTML code.
|
|||||||
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
|
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
event_copy_data = EventPluginSignal(
|
||||||
|
providing_args=["other"]
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
This signal is sent out when a new event is created as a clone of an existing event, i.e.
|
||||||
|
the settings from the older event are copied to the newer one. You can listen to this
|
||||||
|
signal to copy data or configuration stored within your plugin's models as well.
|
||||||
|
|
||||||
|
You don't need to copy data inside the general settings storage which is cloned automatically,
|
||||||
|
but you might need to modify that data.
|
||||||
|
|
||||||
|
The ``sender`` keyword argument will contain the event of the **new** event. The ``other``
|
||||||
|
keyword argument will contain the event to **copy from**.
|
||||||
|
"""
|
||||||
|
|
||||||
periodic_task = django.dispatch.Signal()
|
periodic_task = django.dispatch.Signal()
|
||||||
"""
|
"""
|
||||||
This is a regular django signal (no pretix event signal) that we send out every
|
This is a regular django signal (no pretix event signal) that we send out every
|
||||||
|
|||||||
Reference in New Issue
Block a user