When you change data on your database ALWAYS use the http POST method.
So your view should check if request.method == 'POST' and then proceed
to change the rating. It should also check if the user is
authenticated and if she already voted.
As for the ajax part have a look at the jQuery
Also, if you DO choose to pass JSON back to your client, you should
serialize it first. See this:
http://docs.djangoproject.com/en/dev/topics/serialization/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
On Oct 20, 8:23 am, Sithembewena Lloyd Dube wrote:
> Hi all,
>
> I have a page where users can rate a video, and in models.py I have a video
> model with a 'rating' property. I wish to find out how I can AJAXify the
> rating button on the page, so that if a user clicks on it,
> I would like to do this without using a view or doing a form POST or GET of
> any kind. Any pointers?
Why? If you're building a web app, you should use HTTP to for the
client to communicate with the app (AJAX is just another form of that
communication).
You're almost there, though, because
Hi all,
I have a page where users can rate a video, and in models.py I have a video
model with a 'rating' property. I wish to find out how I can AJAXify the
rating button on the page, so that if a user clicks on it, the button can
call a custom function and pass the video id (cannot call a view
5 matches
Mail list logo