Allow to pass user data to the widget (#1095)

- [x] Logic
- [x] Tests
- [x] Docs
- [x] find a way to integrate with tracking
This commit is contained in:
Raphael Michel
2018-11-20 17:55:37 +01:00
committed by GitHub
parent b49b2035bd
commit beb0ded6dc
10 changed files with 335 additions and 29 deletions

View File

@@ -309,7 +309,10 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
@cached_property
def contact_form(self):
initial = {
'email': self.cart_session.get('email', '')
'email': (
self.cart_session.get('email', '') or
self.cart_session.get('widget_data', {}).get('email', '')
)
}
initial.update(self.cart_session.get('contact_form_data', {}))
return ContactForm(data=self.request.POST if self.request.method == "POST" else None,