title: How to have template tags recognized in a context variable in DJango
body: <p>I have a Django template that displays a link generated with template tags, and I want to send it as a context variable:</p>
  
  <p>views.py:</p>
  
  <pre><code>def my_view(request):
      ...
      link = '''&lt;a href="{% url 'quests:drop' s.id %}"&gt;Drop&lt;/a&gt;'''
  
      context = {
          'link': link,
      }
      return render(request, "my_template.html" , context)
  </code></pre>
  
  <p>I am trying this in my_template.html:</p>
  
  <p><code>{{ link | safe }}</code> </p>
  
  <p>but the link is literally rendered as "{% url 'quests:drop' s.id %}"</p>
  
  <p>Is there a way to have the template tags sent in the context variable recognized and executed by the template engine?</p>
  
  <p>EDIT:</p>
  
  <p>Why I am trying to do this is because I will actually be sending a list of buttons to the template, each with a different link and text, which will be looped through (in this example, looping through various 's' objects),  and multiple views will be using the template (each view with their own button set), so the buttons are extremely context specific. </p>
  
  <p>My template was becoming a spaghetti of logic to handle all the situations, and sending the buttons in the context seems like it would be much more DRY and result in a cleaner, easier to read template.</p>
  
  <p>EDIT 2:</p>
  
  <p>Another option that could solve the problem is if I could just pass the changing parts:</p>
  
  <pre><code>    link_data = ['quests:drop','Drop']
      context = {
          'link_data': link_data,
      }
      return render(request, "my_template.html" , context)
  </code></pre>
  
  <p>And then the template would have:</p>
  
  <pre><code>&lt;a href="{% url '{{link_data.0}}' s.id %}"&gt;{{link_data.1}}&lt;/a&gt;
  </code></pre>
  
  <p>However, as is, {{link_data}} doesn't render and I get the error:</p>
  
  <pre><code>Reverse for '{{ link_data.0 }}' ... not found.
  </code></pre>