Detecting a URL in a Django wizard_form.html template -
i have 3 surveywizardviews of use same standard wizard_form.html located @ templates/formtools/wizard/wizard_form.html as per documentation
i have added basic logic template designed detect page of form user on can include non standard page/step, image js slider bar underneath. works perfectly.
{% if wizard.steps.current == '6' %} <img src="{% static "survey/images/pathtwo/" %}{{display_image}}"/> <section> <span class="tooltip"></span> <div id="slider"></div> <span class="volume"></span> </section> {% endif %} however want have different experience user depending on view/url coming from.
question possible detect url view using @ page? e.g.
{% if url.current == 'www.mywebsite.com/experiment/surveyone/' %} x {% if url.current == 'www.mywebsite.com/experiment/surveytwo/' %} y i have done searching im not sure i'm searching honest. appreciated.
you can use request context variable. like:
{% if 'experiment/surveyone' in request.path %} {% endif %} i prefer using in instead of == ignore trailing , leading slashes. if want whole thing try build_absolute_uri method. check options request offer (https://docs.djangoproject.com/en/dev/ref/request-response/#httprequest-objects).
finally, don't forget add django.core.context_processors.request template_context_processors (i think added default).
Comments
Post a Comment