Thursday, March 31, 2011

Re: Need help: request.POST.copy() ?

Sorry the last example I gave maybe wrong. I think I'm actually
getting the data back out using the cleaned_data. I'm trying to do
this from memory, since this is a work problem and I've been
struggling with it since the middle of this afternoon and it's been
very frustrating.

On Mar 31, 8:24 pm, hank23 <hversem...@stchas.edu> wrote:
> Currently I have logic in place that makes a copy of request.POST so
> it can put data from a record using a key, gotten from the previous
> bunch of POSTed data, on the screen for display purposes. This all
> works fine. But when I go in and alter some of the data being
> displayed then the next time I submit the form the data that I just
> entered is not displaying in the request.POST dictionary when I look
> at it. So what am I apparently not doing right to cause the data to be
> lost? I display the data to the screen after making a copy of
> request.POST (request.POST.copy()) like this:
>
> request.POST['title'] = record.title
>
> I actually call sub views from the main view which processes this
> screen, display the data as shown above as well as capture the changes
> to the request.POST dictionary like this:
>
> title = request.POST['title']
>
> After trying to capture the data this way then I try to write it to
> the database, but nothing new is being saved, so that's why I'm
> wondering why no new data  is being saved.
>
> On Mar 31, 8:07 pm, Sam Walters <mr.sam...@gmail.com> wrote:
>
>
>
> > Hi hank23
> > request.POST would be immutable.
>
> > "QueryDict instances are immutable, unless you create a copy() of
> > them. That means you can't change attributes of request.POST and
> > request.GET directly."
>
> >http://docs.djangoproject.com/en/dev/ref/request-response/
>
> > So I'm
>
> > > wondering if there is something else going on or if this problem is
> > > some kind of side effect of using request.POST.copy()?
>
> > I dont know what you mean by side-effect.
>
> > I copy/instantiate querydicts all the time never had any problems.
> > Dont forget if you can use python to clone objects :)
>
> > cheers
>
> > sam_W
>
> > On Fri, Apr 1, 2011 at 11:48 AM, hank23 <hversem...@stchas.edu> wrote:
> > > I need to know when I can or should use request.POST.copy() when
> > > processing screens, as opposed to when not to use it. I've used it
> > > some, on one screen in particular, which seems to work fine for
> > > displaying the data that I want to display, when I put the data on the
> > > screen programatically from within a view. However when I try to alter
> > > the data manually by keying it in from my keyboard, or selecting an
> > > option from a dropdown, nothing seems to show up changed the next time
> > > that submit the form to the view and look at the data posted. So I'm
> > > wondering if there is something else going on or if this problem is
> > > some kind of side effect of using request.POST.copy()?
>
> > > --
> > > 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+unsubscribe@googlegroups.com.
> > > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.-Hide quoted text -
>
> > - Show quoted text -- 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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment