On Tue, 2009-08-11 at 17:27 -0700, David wrote:
> Any tips/suggestions are highly appreciated...

One tip is to wait more than eight hours before posting "please help me"
yet again.

> 
> 
> 
> On Aug 11, 9:26 am, David <[email protected]> wrote:
> > Just a little more information. The autoField id is in the model
> > class.  Model_Form is a form based on this model class.
> >
> > On Aug 11, 9:20 am, David <[email protected]> wrote:
> >
> >
> >
> > > Hello,
> >
> > > I am trying to retrieve an autoField id value in my following code
> > > when I update records.
> >
> > > def update_record(request):
> > >     if request.POST:
> > >         form = Model_Form(request.POST)
> > >         if form.is_valid():
> > >             form.save(pk=form.id, force_update=True)
> >
> > > I got an error that "Model_Form" object has no attribute 'id'.
> >
> > > Model_Form is a model-based form class that has an autoField id that
> > > increases one by one. When I update a record, I need to give this
> > > value.
> >
> > > I even tried "pk=form.pk", however it did not work either.

ModelForm subclasses don't include any AutoField values. By definition,
they are *automatically* assigned by the database. If you're using an
AutoField, you don't set it yourself. If you want to manage the primary
key value yourself, don't make it an AutoField.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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