Page 1 of 1

Help needed when writing new app, when retrieve data from another wizard_step class

Posted: Tue Apr 07, 2020 10:38 am
by rosario.dandrea
Hi Rosario,
I'm trying to get a selection from the previous wizard step (an id, in this case) using the URL function with the following code:

Code: Select all

    def get_form_kwargs(self, wizard):
        id_company_list = URL(query_string=None).args.getlist('companies')
        for id in id_company_list:
            company_id = id

        return {
            'help_text': _('Associate an offer to Document.'),
            'permission': permission_offer_associated,
            'queryset': Offer.objects.filter(company=company_id),
            'user': wizard.request.user
But I do get the following error:
" 'queryset': Offer.objects.filter(company=company_id),
UnboundLocalError: local variable 'company_id' referenced before assignment

Not sure what I am doing wrong here. Any helpful pointers?

Thanks again for your time.

Best regards,