Saturday, November 28, 2015

Re: Correct way to do async forms

Hi, 

If you want to do it async, you need to use JavaScript to make ajax requests. And you need an endpoint that would respond to your ajax request. You can use the same django view to both serve the html and handle the JS request. However, that might make the business logic more complex. I would usually have a separate view for it. 

Regards,
Masnun



On Saturday, November 28, 2015 at 7:08:02 AM UTC+6, Jonty Needham wrote:

Hi,
I need to do a file upload in django where if the file fails appropriate checks then an error is raised back to the user without 500ing the page.

I've got a form that does what I want, however it returns the error in a new page, but I want it returned in place. So I need an async call. What's the correct easy to do all this? I've seen a method on line where I need to write another view to take care of the form data but that seems ugly. It seems like there should be a better easy in django.

Thanks in advance.
Jonty

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/358bee2f-0bae-4087-aca7-233c1a8de998%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment