I want it to be rendered directly in the javascript:
...
events: [{{}} = jsonData]
_____________________________________________
*Gilson Filho*
*Web Developer
Blog:* blog.gilsondev.com
*Twitter:* twitter.com/gilsonfilho
2011/1/20 DenesL <[email protected]>
>
> You either return the json yourself or you let web2py do it.
>
> If you do it:
>
> response.headers['Content-Type']='application/json'
> return json.dumps(dict(id=ag.agenda.id, ...))
>
> or if you want web2py to do it:
>
> return dict(id=ag.agenda.id, ...)
>
> and call it with .../index.json
> in this case you are using the generic.json view.
>
>
> On Jan 19, 6:51 pm, "[email protected]"
> <[email protected]> wrote:
> > 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
>