forked from CGM_Public/pretix_original
Add request argument to contact_form_fields signal
This commit is contained in:
@@ -312,6 +312,7 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
|||||||
initial.update(self.cart_session.get('contact_form_data', {}))
|
initial.update(self.cart_session.get('contact_form_data', {}))
|
||||||
return ContactForm(data=self.request.POST if self.request.method == "POST" else None,
|
return ContactForm(data=self.request.POST if self.request.method == "POST" else None,
|
||||||
event=self.request.event,
|
event=self.request.event,
|
||||||
|
request=self.request,
|
||||||
initial=initial)
|
initial=initial)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
@@ -517,7 +518,7 @@ class ConfirmStep(CartMixin, AsyncAction, TemplateFlowStep):
|
|||||||
ctx['cart_session'] = self.cart_session
|
ctx['cart_session'] = self.cart_session
|
||||||
|
|
||||||
ctx['contact_info'] = []
|
ctx['contact_info'] = []
|
||||||
responses = contact_form_fields.send(self.event)
|
responses = contact_form_fields.send(self.event, request=self.request)
|
||||||
for r, response in sorted(responses, key=lambda r: str(r[0])):
|
for r, response in sorted(responses, key=lambda r: str(r[0])):
|
||||||
for key, value in response.items():
|
for key, value in response.items():
|
||||||
v = self.cart_session.get('contact_form_data', {}).get(key)
|
v = self.cart_session.get('contact_form_data', {}).get(key)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class ContactForm(forms.Form):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.event = kwargs.pop('event')
|
self.event = kwargs.pop('event')
|
||||||
|
self.request = kwargs.pop('request')
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
if self.event.settings.order_email_asked_twice:
|
if self.event.settings.order_email_asked_twice:
|
||||||
@@ -35,7 +36,7 @@ class ContactForm(forms.Form):
|
|||||||
help_text=_('Please enter the same email address again to make sure you typed it correctly.')
|
help_text=_('Please enter the same email address again to make sure you typed it correctly.')
|
||||||
)
|
)
|
||||||
|
|
||||||
responses = contact_form_fields.send(self.event)
|
responses = contact_form_fields.send(self.event, request=self.request)
|
||||||
for r, response in sorted(responses, key=lambda r: str(r[0])):
|
for r, response in sorted(responses, key=lambda r: str(r[0])):
|
||||||
for key, value in response.items():
|
for key, value in response.items():
|
||||||
# We need to be this explicit, since OrderedDict.update does not retain ordering
|
# We need to be this explicit, since OrderedDict.update does not retain ordering
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ and by default only asks for the email address. You are supposed to return a dic
|
|||||||
form fields with globally unique keys. The validated form results will be saved into the
|
form fields with globally unique keys. The validated form results will be saved into the
|
||||||
``contact_form_data`` entry of the order's meta_info dictionary.
|
``contact_form_data`` entry of the order's meta_info dictionary.
|
||||||
|
|
||||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
|
||||||
|
argument will contain the request object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
question_form_fields = EventPluginSignal(
|
question_form_fields = EventPluginSignal(
|
||||||
|
|||||||
Reference in New Issue
Block a user