Thursday, March 29, 2012

Re: Can I POST edit form to detail view, and redirect back if invalid?

I don't see anything on there that deals with transferring an
redirecting with POST data. Is there a particular section that covers
this?

To be honest, I'm not sure if HTTP really supports what I'm trying to
do, let alone Django.

On Mar 30, 12:32 am, Joel Goldstick <joel.goldst...@gmail.com> wrote:
> On Thu, Mar 29, 2012 at 7:13 AM, Hemebond <hemeb...@gmail.com> wrote:
> > What can I pass back to the edit form view that already contains the
> > values and errors and how? Posting to the edit form view would work
> > but that would re-process the form.
>
> > On Mar 30, 12:06 am, Joel Goldstick <joel.goldst...@gmail.com> wrote:
> >> On Thu, Mar 29, 2012 at 6:33 AM, Hemebond <hemeb...@gmail.com> wrote:
> >> > I want to use the URL of an object (a detail view) as the destination
> >> > for CRUD operations. I want it to be able to accept GET, POST and
> >> > DELETE requests.
>
> >> > As part of this, I want the edit form (retrieved by appending /edit/
> >> > to the object URL) to submit to the object URL. If the form is
> >> > invalid, I then need to redirect back to the edit form, and display
> >> > the errors.
>
> >> > Is this possible? Is there a way to redirect back to the edit form
> >> > with the new values and the errors that occurred during processing?
>
> >> yes
>
> You need to look at form handling in django.  Here is a good starting
> point:http://www.djangobook.com/en/2.0/chapter07/
>
> Then look at model forms.
>
> --
> Joel Goldstick

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