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_<fieldname> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to