mirror of
https://github.com/pretix/pretix.git
synced 2026-04-26 23:52:35 +00:00
Questions step: Only prefill customer name for first ticket (#2555)
This commit is contained in:
@@ -58,7 +58,7 @@ class BaseQuestionsViewMixin:
|
||||
def _positions_for_questions(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_question_override_sets(self, position):
|
||||
def get_question_override_sets(self, position, index):
|
||||
return []
|
||||
|
||||
def question_form_kwargs(self, cr):
|
||||
@@ -72,7 +72,7 @@ class BaseQuestionsViewMixin:
|
||||
submitted at once.
|
||||
"""
|
||||
formlist = []
|
||||
for cr in self._positions_for_questions:
|
||||
for idx, cr in enumerate(self._positions_for_questions):
|
||||
cartpos = cr if isinstance(cr, CartPosition) else None
|
||||
orderpos = cr if isinstance(cr, OrderPosition) else None
|
||||
|
||||
@@ -96,7 +96,7 @@ class BaseQuestionsViewMixin:
|
||||
))
|
||||
)
|
||||
|
||||
override_sets = self.get_question_override_sets(cr)
|
||||
override_sets = self.get_question_override_sets(cr, idx)
|
||||
for overrides in override_sets:
|
||||
for question_name, question_field in form.fields.items():
|
||||
if hasattr(question_field, 'question'):
|
||||
|
||||
@@ -735,9 +735,9 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
|
||||
return f
|
||||
|
||||
def get_question_override_sets(self, cart_position):
|
||||
def get_question_override_sets(self, cart_position, index):
|
||||
o = []
|
||||
if self.cart_customer:
|
||||
if self.cart_customer and index == 0:
|
||||
o.append({
|
||||
'attendee_name_parts': {
|
||||
'initial': self.cart_customer.name_parts
|
||||
|
||||
@@ -729,7 +729,7 @@ class OrderModify(EventViewMixin, OrderDetailMixin, OrderQuestionsViewMixin, Tem
|
||||
return []
|
||||
return super().positions
|
||||
|
||||
def get_question_override_sets(self, order_position):
|
||||
def get_question_override_sets(self, order_position, index):
|
||||
override_sets = [
|
||||
resp for recv, resp in question_form_fields_overrides.send(
|
||||
self.request.event,
|
||||
|
||||
Reference in New Issue
Block a user