Szaijan wrote:
Is there a way to access the URL values assigned to the view names
within a view?  Perhaps something less inelegant than importing
urls.py and searching for the view name in the tuple?  Otherwise I've
traded hardcoding URLs into one template for hard coding them into 5+
views.

Does http://www.djangoproject.com/documentation/templates/#url not do what you want?

eg:

# urls.py
 url(r'^products/(?P<id>\d+)', 'views.show_product', name='product_info'),


# template
{% for product in products %}
<!-- Other stuff -->
<a href="{% url product_info product.id %}">Details</a>
{% endfor %}


Cheers
-Darryl


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to