Re: How to modify and then recombine json response data without breaking json formatting

2015-03-12 Thread Henry Versemann
rence in the way the keys *"participations"* and *"page_views"* of each object are formatted as opposed to the two new keys *"name"* and *"id"* that my code added to the individual json response data now in python object form. The final file *Send_Request_View_C

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-10 Thread Bill Freeman
;re showing. On Mon, Mar 9, 2015 at 3:35 PM, Henry Versemann wrote: > OK here goes. The logic in the routine which I actually doing the > modification to each individual JSON response looks like this: > > if str(objctTyp) == 'user': > rspnsdata['nam

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Henry Versemann
OK here goes. The logic in the routine which I actually doing the modification to each individual JSON response looks like this: if str(objctTyp) == 'user': rspnsdata['name'] = lstobjct['name'] rspnsdata['id'] = lstobjct

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Henry Versemann
OK here goes. The logic in the routine which is actually doing the modification to each individual JSON response looks like this: if str(objctTyp) == 'user': rspnsdata['name'] = lstobjct['name'] rspnsdata['id'] = lstobjct[&

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Bill Freeman
I print it in my command prompt window right >>> before sending it back to the client, as part of an HttpResponse. Then when >>> I try to access some of the data using javascript/jQuery once its >>> been sent back to the client then some of the "jQuery.parseJSON()"

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Henry Versemann
gt; I try to access some of the data using javascript/jQuery once its >> been sent back to the client then some of the "jQuery.parseJSON()" >> statements fail when I try to access the data I've formatted in the view, >> for my response. >> >> So my ne

Re: How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Bill Freeman
se. Then when > I try to access some of the data using javascript/jQuery once its > been sent back to the client then some of the "jQuery.parseJSON()" > statements fail when I try to access the data I've formatted in the view, > for my response. > > So my next question is how do

How to modify and then recombine json response data without breaking json formatting

2015-03-09 Thread Henry Versemann
lient, as part of an HttpResponse. Then when I try to access some of the data using javascript/jQuery once its been sent back to the client then some of the "jQuery.parseJSON()" statements fail when I try to access the data I've formatted in the view, for my response. So my

Re: JSON Response

2015-02-20 Thread elcaiaimar
I solved it! Sorry, at last I had a bad called to jquery library in my base.html. I had to check all my project Thank you for your answers, you have helped me a lot! El viernes, 20 de febrero de 2015, 21:01:46 (UTC+1), elcaiaimar escribió: > > Please, have a look at this tutorial: > https://www.

Re: JSON Response

2015-02-20 Thread elcaiaimar
Please, have a look at this tutorial: https://www.youtube.com/watch?v=Pxn5L1qJTAw Sorry, It's in spanish, but it's what I'm doing. I've tried to put the same code but it doesn't work because he uses an older version of django. If you don't want to see all the video, you can see the minute 12:16.

Re: JSON Response

2015-02-20 Thread Daniel Roseman
What it sounds like actually is that the OP is not preventing the default action of the form, so the page is being submitted normally and displaying the response. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: JSON Response

2015-02-20 Thread Collin Anderson
Hi, It sounds like you click "submit" and then get a page showing the raw json? That sounds like it could be a bug in your code. Either the event handler is not connected, or there's an error. You could try checking "Preserve Log" in the developer console. Collin On Thursday, February 19, 201

Re: JSON Response

2015-02-19 Thread Vijay Khemlani
What is the actual content of the respose you are getting back from the server? On Thu, Feb 19, 2015 at 7:06 PM, elcaiaimar wrote: > I mean in a correct form. My code doesn't work. It seems like the JS code > doesn't receive the jsonresponse. > I get a page with {"status":"True","product_id":p.i

Re: JSON Response

2015-02-19 Thread elcaiaimar
I mean in a correct form. My code doesn't work. It seems like the JS code doesn't receive the jsonresponse. I get a page with {"status":"True","product_id":p.id} But this should be read for the JS code, and if it's True show an alert saying Remove it! Is there anything wrong in my code? El jue

Re: JSON Response

2015-02-19 Thread Vijay Khemlani
What do you mean with "in a good way"? Does your code work? On Thu, Feb 19, 2015 at 4:14 PM, elcaiaimar wrote: > Hello, > > I was wondering how I can send a response JSON in a good way, because I > have the next code: > > if "product_id" in request.POST: > try: > id_p

JSON Response

2015-02-19 Thread elcaiaimar
Hello, I was wondering how I can send a response JSON in a good way, because I have the next code: if "product_id" in request.POST: try: id_producto = request.POST['product_id'] p = Pozo.objects.get(pk=id_producto) mensaje = {"status":"

Re: stop caching json response

2011-02-20 Thread Eric Hutchinson
check out: http://docs.djangoproject.com/en/1.2/topics/cache/#controlling-cache-using-other-headers On Feb 20, 7:06 am, Олег Корсак wrote: > Hello. I have memcached mw enabled. And I can see that response is > cached in memcached. I want to stop caching that. How is it possible to > do? Thanks >

Re: stop caching json response

2011-02-20 Thread Shawn Milochik
A quick and dirty way is to append a timestamp to the URL so it's always unique. That way it won't be cached. Add "new Date().getTime()" to the end of the URL your AJAX call requests. Just have your url pattern accept and ignore the extra stuff. Shawn -- You received this message because you ar

stop caching json response

2011-02-20 Thread Олег Корсак
Hello. I have memcached mw enabled. And I can see that response is cached in memcached. I want to stop caching that. How is it possible to do? Thanks def do_something(request): return HttpResponse('yoyoyo23', content_type = 'application/javascript; charset=utf8') signature.asc Descripti

Re: Sending JSON response from views

2009-07-13 Thread Shawn Milochik
> > > The question, how can I return username of user in fields. I want > the JSON response to contain value user.username instead of id of > user oject > > Thanks, > Oleg > Get everything you want into a dictionary. Then something like this will give

Re: Sending JSON response from views

2009-07-12 Thread Eugene Mirotin
veList = ActiveList.objects.all() > >     data = serializers.serialize("json", activeList, fields = (u'user', > 'status')) >     return HttpResponse(data, mimetype='application/json') > > The question, how can I return username of user

Sending JSON response from views

2009-07-11 Thread Oleg Oltar
ize("json", activeList, fields = (u'user', 'status')) return HttpResponse(data, mimetype='application/json') The question, how can I return username of user in fields. I want the JSON response to contain value user.username instead of id of user oject Tha

serializing vs. building a JSON response -- is there a best practice?

2009-02-06 Thread Serdar T.
a "best practice" or convention for returning JSON from Django. My initial Django view built up a JSON response by looping over the results of a database query. A friend who uses a different language/framework then advised that I should avoid building my own JSON responses and instead re