Friday, October 11, 2013

Re: Call method of the session template

On Friday, 11 October 2013 13:45:01 UTC+1, Ricardo wrote:
I understand what you say, however I know only call methods using {% url 'app.view.func'%} or {%}% app.view.func.
As I understand this django-aap carton, the shopping cart in the session live. If it is in session I would have
access their methods and attributes. Well that's exactly what I'm not getting. Access method remove_single.
In this href = "" is an image that removes the items you want to call the method remove_simgle.
Actually I'm wrong in doing {% url%} because I do not want move pages. I just want to remove the item from the cart.


It makes absolutely no difference if it lives in the session, you still can only modify it by calling a URL on the server. By the time the user sees the template, it is rendered to just HTML. The HTML in the user's browser does not have access to the methods of a session object which lives on the server. The only thing you can do from the browser is call a URL.

Now, if you like, you can call that URL via Ajax, so the user doesn't actually have to navigate to another page: but the fact remains, the only way to modify something on the server - whether in the session, the db, or even a file on disk - is by calling a URL.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/37220bb2-0720-44d4-95e1-d59264146f5b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate