Setting href to dynamic view name

Janson
 {% for stg in statusUrl %}
            <tr>
                <td>{{forloop.counter}}</td>
                <td>{{stg.title}}</td>
                <td>
                  <a href="{% url {{stg.addLink}} %}" class="btn text-secondary px-0">
                    <i class="fas fa-plus"></i></a>
                   </a>
                

                  <a href="{% url {{stg.editLink}} invoice.id %}" class="btn text-secondary px-0">
                      <i class="fa fa-edit fa-lg"></i>
                    </a> 

                  <a href="{% url {{stg.deleteLink}} invoice.id %}" class="btn text-secondary px-0">
                      <i class="far fa-trash-alt fa-lg text-danger float-right"></i>
                   </a> 

                  <a href="{% url {{stg.previewLink}} invoice.id %}" class="btn text-secondary px-0">
                      <i class="fas fa-file-invoice"></i>
                   </a>
                </td>
            </tr>
            {% endfor %}

Trying to pass urls.py view names dynamically to template and then creating hyperlink to each view. How can href be adjusted to handle it.

Elvin Jafarov

I do not know what stg.addLink returns but to make it work you need to change

from


"{% url {{stg.editLink}} invoice.id %}"

to


"{% url stg.editLink invoice.id %}"

BUT AGAIN it may not work. It depents what stg.editLink returns

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

dynamic variable setting <href> into Ajax

From Dev

Dynamic table name setting with PDO

From Dev

Setting a dynamic sort name field in a linq query

From Dev

MVC Performance: Setting view name vs leaving it blank

From Dev

Setting view's name from decorator - Angular Ui Router

From Dev

Setting the table view cell's name based on picker selection

From Dev

Given ClearCase stream name, how to get tag of local dynamic view?

From Dev

${!name:=val} not setting $name?

From Dev

${!name:=val} not setting $name?

From Dev

InstantClick not binding to dynamic href

From Dev

HTML href dynamic syntax

From Dev

setting the width of the grid view column to dynamic without compromising the minimum width for the control

From Dev

Setting variables in a href link in html

From Dev

Setting Clicking Priority for a div with an href

From Dev

Dynamic output format setting

From Dev

Setting bounds for dynamic arrays

From Dev

Setting up a dynamic webserver

From Dev

Setting noopener for dynamic url

From Dev

Why does setting the Name attribute explicitly on a Partial View input cause the Value to change after POST?

From Dev

Why does setting the Name attribute explicitly on a Partial View input cause the Value to change after POST?

From Dev

Differentiate between a name and a href

From Dev

Setting OnClick() for an android view

From Dev

setting view of fragment

From Dev

Setting a tag to a view

From Dev

UITabbarController setting initial view

From Dev

Setting the view programmatically

From Dev

Setting a cookie in a Django view

From Dev

Understanding setting a view

From Dev

Add a dynamic jquery a href into a dynamic jquery div

Related Related

HotTag

Archive