Re: Trying to get ifequal to evaluate to True
On Jun 30, 9:00 pm, "Paolo Ambrosio" <[EMAIL PROTECTED]> wrote: > I just built a test application and it works for me, if I understood > what is your problem. > [...] > P.S. > I am using the trunk > Many thanks for taking out the time to build a test application. I really appreciate that. Thanks. Trying to follow in with your example, I realised what was going wrong. The login template I am working with extends a base template, and so naturally fills in blocks only from the parent template. The {% ifequal %} expression, for some reason that didn't stand out before, was placed outside of any of the required main blocks. No sooner than I moved the expression inside one of the main blocks that it started to work as expected. Many thanks, again. :) -- Ayaz Ahmed Khan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trying to get ifequal to evaluate to True
On Mon, Jun 30, 2008 at 5:14 PM, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote: > > On Jun 30, 8:05 pm, "Paolo Ambrosio" <[EMAIL PROTECTED]> > wrote: >> On Mon, Jun 30, 2008 at 4:52 PM, Ayaz Ahmed Khan >> >> <[EMAIL PROTECTED]> wrote: >> > [...] The variable "next" >> > does have that particular value (I verified both by printing it out >> > and by making sure {% if next %} evaluates to True). However, the >> > "ifequal" expression just doesn't work. >> >> Are you passing it through the context while invoking the template? > > I, myself, am not passing that particular value. I am calling the > built-in login view provided by Django -- which is ``from > django.contrib.auth.views import login''. That view passes the "next" > as part of the context while rendering the login template. I just built a test application and it works for me, if I understood what is your problem. I created a view protected by the @login_required decorator, mapped to two different urls: 1) /accounts/test1/ 2) /accounts/test2/ The login_required redirects to /accounts/login/?next=... that calls the same view you are using. And this is my template ("registration/login.html"): {{ next }} - {% ifequal next "/accounts/test1/" %}true{% endifequal %} If I go to http://localhost:8000/accounts/test1/, I am redirected to http://localhost:8000/accounts/login/?next=/accounts/test1/ that shows: /accounts/test1/ - true otherwise if I go to http://localhost:8000/accounts/test2/ I see: /accounts/test2/ - Maybe yours is just a typo. Paolo P.S. I am using the trunk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trying to get ifequal to evaluate to True
On Jun 30, 8:05 pm, "Paolo Ambrosio" <[EMAIL PROTECTED]> wrote: > On Mon, Jun 30, 2008 at 4:52 PM, Ayaz Ahmed Khan > > <[EMAIL PROTECTED]> wrote: > > [...] The variable "next" > > does have that particular value (I verified both by printing it out > > and by making sure {% if next %} evaluates to True). However, the > > "ifequal" expression just doesn't work. > > Are you passing it through the context while invoking the template? I, myself, am not passing that particular value. I am calling the built-in login view provided by Django -- which is ``from django.contrib.auth.views import login''. That view passes the "next" as part of the context while rendering the login template. -- Ayaz Ahmed Khan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trying to get ifequal to evaluate to True
On Mon, Jun 30, 2008 at 4:52 PM, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote: > [...] The variable "next" > does have that particular value (I verified both by printing it out > and by making sure {% if next %} evaluates to True). However, the > "ifequal" expression just doesn't work. Are you passing it through the context while invoking the template? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---