Just pop this into your template: {% url Path.to.a.view.for.this.template as the_url %} # you are importing a view's url structure right here and then storing it as "the_url". Since you're not looking for anything dynamic we can end that definition here (more here http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url) then {% ifequal the_url "/the/url/to/check" %} pretty self explanatory this is the result if that is true {% endifequal %}
It might be a good idea to check this before adding any conditional statement: {% url Path.to.a.view.for.this.template as the_url %} {{ the_url }} should output the relative URL (django calls relative paths absolute paths for some reason) On Mar 10, 3:42 pm, HARRY POTTRER <cp368...@ohio.edu> wrote: > maybe try request.path? > > On Mar 10, 1:51 pm, Daxal <daxal.someone...@gmail.com> wrote: > > > Hey, > > > I wanted to use a if statement with a url like ... > > > if you are on "/cm/add/" > > ...... > > endif > > . > > option 1: > > I was wondering if anyone knows how to code that statement. if can > > compare string variables like {% ifequal somevariable url %} where > > "url" can be hard coded like "/cm/add" and somevariable would have to > > store the url which i think is too complex. > > > option 2: > > some if statement that directly compares the url like {% if {url} == "/ > > cm/add/" %} > > > any thoughts and ideas guys? > > > Thank you for all your replies. :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.