Wonderful :-)
On Mar 8, 11:02 pm, Bastian Hoyer wrote:
> On 7 Mrz., 23:23, Let Delete My Apps wrote:
>
> > results = []
> > for app in apps:
> > results.append({"appname" : app.appname})
>
> just a small tip.. you can write this as
>
> results = [ {"appname": app.appname} for app in apps ]
On 7 Mrz., 23:23, Let Delete My Apps wrote:
> results = []
> for app in apps:
> results.append({"appname" : app.appname})
>
just a small tip.. you can write this as
results = [ {"appname": app.appname} for app in apps ]
--~--~-~--~~~---~--~~
You received
Not sure if this is the best way but I wrote a class that all my
models inherit.
from django.utils import simplejson
from google.appengine.ext import db
from google.appengine.api import users
from datetime import *
import string
class json():
def getString(self):
s= {}
p = se
An example from my last app:
results = []
for app in apps:
results.append({"appname" : app.appname})
# for JSONP
callback = this.request.get("callback")
this.response.headers["Content-Type"] = "text/javascript"
callback = "%s(%s)" % (callback, json.write(result))
this.response.out.write(cal
The easiest way is to write a to_dict() method on your models, and
then call that before converting to json.
On Mar 6, 6:28 am, Devraj Mukherjee wrote:
> Hi all,
>
> Quick question about converting model objects in JSON. Have done some
> reading and I can't find a way to use simplejson to serial
check this http://deron.meranda.us/python/comparing_json_modules/
you will have to stuck with a pure python library
On Fri, Mar 6, 2009 at 1:28 PM, Devraj Mukherjee wrote:
>
> Hi all,
>
> Quick question about converting model objects in JSON. Have done some
> reading and I can't find a way to us