Hello guys,
I'm wanting an action returns a json like this:
{
"start": "2011-01-27",
"id": 4,
"title": "Fulano Silva"
}
Only to send to the view he is being rendered thus:
"{\n \"start\": \"2011-01-27\", \n
\"id\": 4, \n \"title\": \"Fulano
Silva\"\n}"
The code I made to return the JSON looks like:
import simplejson as json
def index():
# Consultando os servicos do usuario logado
query = db.agenda.id > 0 and db.agenda.funcionario ==
> session.auth.user.id and db.agenda.cliente == db.cliente.id
agenda = db(query).select(orderby = db.agenda.data)
teste2 = list(agenda)
for ag in agenda:
teste =
json.dumps({"id":ag.agenda.id,"title":ag.cliente.nome,"start":ag.agenda.data.strftime('%Y-%m-%d')},indent=4)
>
return dict(teste = response.json(teste))
What should I do?
_____________________________________________
*Gilson Filho*
*Web Developer
Blog:* blog.gilsondev.com
*Twitter:* twitter.com/gilsonfilho