One tip is to wait more than eight hours before posting "please help me"
yet again.
>
>
>
> On Aug 11, 9:26 am, David <Ww...@yahoo.com> 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 <Ww...@yahoo.com> 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