1

I am trying to pass string information into a {% URL %}

I am getting the data from data like:

    {% for p in proj %}

      <tr>
        <td>
          <a href="{% url  {{ p.dir }} %}"> {{ p.name }} </a>
        </td>
      </tr>

    {% endfor %}

The expected result would be something like:

<a href="{% url "path" %}">Sample Info</a>

Is this even possible?

Thanks.

1 Answer 1

2

From the documentation:

The first argument is a URL pattern name. It can be a quoted literal or any other context variable.

So you need to use {% url p.dir %}

Sign up to request clarification or add additional context in comments.

1 Comment

ok, that was way too simple. I was thinking something more complicated. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.