Hi,

I'm sending a variable from my views.py and getting it in my forms.py. 

My form looks like this now: 

class PatchForm1(forms.Form):
    def __init__(self, *args, **kwargs):
        nbi_patch = kwargs.pop('nbi_patch', None)
        super(PatchForm1, self).__init__(*args, **kwargs)

    release_number = forms.CharField(label='Release number:')
                                     
    def clean_release_number(self):
        #nbi_patch =* I want to use the **nbi_patch var from __init__ here*
        release_number = self.cleaned_data.get("release_number")
        path = os.path.join(*nbi_patch*, release_number)
        if not os.path.exists(path):
            raise forms.ValidationError("Hmm... it looks like %s does not 
exist in nbi-patch." % release_number )
        return release_number

I want to use my var nbi_patch from __init__ inside my clean_release_number() 
function. Is that possible? 
 
I tried pass it as a parameter but it didn't work... 

Thanks!!!

Leandro

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/90_l6B36fHsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to