On Sat, May 16, 2009 at 3:03 PM, simon101 <simon...@gmail.com> wrote:

>
> Hi
>
> I am using ModelForms to create forms from the models, and using the
> clean_field and clean methods to validate the fields and form data as
> a  whole.  I get the self.cleaned_data[] dictionary which contains all
> the cleaned up data from the html form, but  it doesn't contain the id
> for the object id for the object which the ModelForm pulled it off.
>
> Anyone got any ideas how to fix this?  My code looks like this.
>
> class Contract(db.Model):
>        storage_required = db.BooleanProperty
> (verbose_name="storage_required")
>
> class ContractForm(ModelForm):
>        storage_required = fields.BooleanField()
>
>        class Meta:
>                model = Contract
>
>        def clean_storage_required(self):
>                stor_req = self.cleaned_data['storage_required']
>                obj_id = ?
>
> btw I am using gae but this shouldn't affect this I think.
>
> Thanks guys
>
> Simon
> >
>
self.instance will be the current object, and therefore
self.instances.pkwill be that object's id.  This is all assuming GAE's
forms work the same as
djangos.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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