I have an app where a user submits some forms. Now I want the user to be able to edit his previous submitted forms. So on the template(e.g old_Webrequests.html) I just load a list with links corresponding to every submitted form(view:old_Webreqs(request,user_id)). {% for a in all_reqs %} <li><a href="#" id="{{ a.id }}" >{{ a }}</a></li> {% endfor %}
According to user's choice I perform an ajax request to a view(edit_wreqs(request, user_id, wr_id )) passing the selected form's id in order to query the object from the db. <script type="text/javascript"> $(document).ready(function () { $("a").on("click", function(event) { event.preventDefault(); var id = $(this).attr("id"); $.get("edit_wreqs"+"/"+id+"/", function(data) { }); }); }); </script> At this point I suppose I will load an instance of that object. But how can I return this instance to the template where the user submits the form(eg main_Webrequests.html) the time the user hits the link?Or how the template will be loaded the time the user hits the link?With my code when the user hits the link the requested object is printed in the terminal but nothing changes on the screen. def edit_wreqs(request, user_id, wr_id ): f = Webrequests.objects.get(id=wr_id) print f if request.method == 'POST': form = WebrequestsForm(data=request.POST, own_id=u_id, instance=f) if form.is_valid(): form.save() return render_to_response('success.html', locals(), context_instance= RequestContext(request)) else: form = WebrequestsForm(instance=f) return render_to_response('main_Webrequests.html', locals(), context_instance= RequestContext(request)) Where am I wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HHsPLznjuOwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.