I'm since las update of GAE Launcher, it creates ID on datastore too big. Like 5330010158992982016, thats a problem to me, because on Javascript these numbers are rounded.
For example, on JS
> a = 533001015899298254645
> 533001015899298270000
an reading a JSON like [{"pk": 5330010158992982016, "model": " .... }],
$.getJSON(' ...
$.each(data, function(i,item){ ...
item['pk'] = 533001015899298270000 instead of 533001015899298254645
}
}
I'm not sure if I'll have the same problem on GAE servers. Any idea to limit ID size?
I'm using Django, but I'm having the same problem with Django and Google Models.
Update:
I found a solution that doesn't force you to change all javascript code of the project. In my case a lot. Like everybody says the best thing is to use de PK (or ID) as a string. But I as using django serializer and in my version and with JSON, the PK is set as a number. The easy solution is change this on the serializer class ( or create a new serializer wich extends original and change this ):
def end_object(self, obj):
self.objects.append({
"model" : smart_unicode(obj._meta),
"pk" : smart_unicode(obj._get_pk_val(), strings_only=**False**),
"fields" : self._current
})
self._current = None
Put strings_only to False. It makes the pk on the JSON goes with quotes. All the javascript code works without changes.
The question is... is there any other way to force django serializer to put it as String?