Re: Another question about form validation?
Thanks everyone. On Jun 23, 1:43 pm, phillc <[EMAIL PROTECTED]> wrote: > class FormFoo(ModelForm): > def __init__(self, obj1, *args, **kwargs): > super(FormFoo, self).__init__(*args, **kwargs) > self.object1 = obj1 > def clean(self): > # use self.object1 here > > On Jun 23, 12:23 pm, Adi <[EMAIL PROTECTED]> wrote: > > > > > do you mean something like this. > > > class FormFoo(ModelForm): > > > def __init__(self,*args,**kwargs): > > self.object1 = kwargs.pop('obj1') > > > def clean(self): > > # use the self.object1 here > > > > > > On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > Pass it through form custom constructor > > > > On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote: > > > > > How do you pass model objects that you may need access to when > > > > implementing the clean() or clean_ methods? > > > > > In other words, how can a form access model objects that it may need > > > > access to perform its validation?- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Another question about form validation?
class FormFoo(ModelForm): def __init__(self, obj1, *args, **kwargs): super(FormFoo, self).__init__(*args, **kwargs) self.object1 = obj1 def clean(self): # use self.object1 here On Jun 23, 12:23 pm, Adi <[EMAIL PROTECTED]> wrote: > do you mean something like this. > > class FormFoo(ModelForm): > > def __init__(self,*args,**kwargs): > self.object1 = kwargs.pop('obj1') > > def clean(self): > # use the self.object1 here > > > > On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > Pass it through form custom constructor > > > On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote: > > > > How do you pass model objects that you may need access to when > > > implementing the clean() or clean_ methods? > > > > In other words, how can a form access model objects that it may need > > > access to perform its validation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Another question about form validation?
do you mean something like this. class FormFoo(ModelForm): def __init__(self,*args,**kwargs): self.object1 = kwargs.pop('obj1') def clean(self): # use the self.object1 here On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Pass it through form custom constructor > > On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote: > > > How do you pass model objects that you may need access to when > > implementing the clean() or clean_ methods? > > > In other words, how can a form access model objects that it may need > > access to perform its validation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Another question about form validation?
Pass it through form custom constructor On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote: > How do you pass model objects that you may need access to when > implementing the clean() or clean_ methods? > > In other words, how can a form access model objects that it may need > access to perform its validation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Another question about form validation?
How do you pass model objects that you may need access to when implementing the clean() or clean_ methods? In other words, how can a form access model objects that it may need access to perform its validation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---