title: How to specify URLs in Django templates?
body: <p>Question is: What's the right way of writing URL in Django templates?</p>
  
  <p>If I write them explicitly (like this):</p>
  
  <pre><code>some_template.html
  
  {% extends "base.html" %}
  {% block someblock %}
      &lt;a href="/some_url"&gt;Anchor&lt;/a&gt;
  {% endblock someblock %}
  </code></pre>
  
  <p>and then I decide to change my URL scheme I will have to change both - template and urls.py module (Seems this way conflicts with the DRY principles)</p>
  
  <p>Another way is to use variables (like this):</p>
  
  <pre><code>some_template.html
  
  {% extends "base.html" %}
  {% block someblock %}
      &lt;a href="{{ url_var }}"&gt;Anchor&lt;/a&gt;
  {% endblock someblock %}
  
  
  views.py
  
  def some_url (request):
      return HttpResponse('Hello, world!')
  
  def another_url (request):
      return render_to_response('some_template.html', {'url_var': reverse('some_url')}
  </code></pre>
  
  <p>But in this case if I use template inheritance I have to specify in context ALL of the url variables (also for the parent templates). Probably it is not a good way too. </p>
  
  <p>So what is the decision?</p>