class BenefitForm(OscarBenefitForm):
range = forms.ModelChoiceField(
queryset=Range.objects.all())
def __init__(self, site=None, *args, **kwargs):
super(OscarBenefitForm, self).__init__(*args, **kwargs)
if site:
self.fields['range'].queryset = Range.objects.filter(site__id=site.id)
class OfferWizardStepView(OscarOfferWizardStepView):
....
def get_form_kwargs(self, *args, **kwargs):
form_kwargs = {}
if self.update:
form_kwargs['instance'] = self.get_instance()
if self.step_name != 'metadata':
form_kwargs['site'] = self._fetch_session_offer().site
session_kwargs = self._fetch_form_kwargs()
form_kwargs.update(session_kwargs)
parent_kwargs = super(OfferWizardStepView, self).get_form_kwargs(
*args, **kwargs)
form_kwargs.update(parent_kwargs)
return form_kwargs
verbose_name=u"Локация"