Вопрос

I want to display a list of objects in a table, no problem doing the table. I want to put links in the data displayed of one column in the template. The question is, how can I pass data in that link to the view?. For example in struts2 and JSPs, I used to do it this way (with param):

<td class="nowrap">
                    <s:url id="unitList" action="doSubject!ShowSubjectUnits">
                    <s:param name="subjectID" value="%{id}" />
                    </s:url>
                    <s:a href="%{unitList}"><s:text name="%{unidades.size()}"/></s:a>
</td>
Это было полезно?

Решение

Maybe you can simply add GET parameters to your url:

<a href="{% url view-name %}?subjectID={{id}}">your link</a>

Even better would be a nice url design with arguments:

<a href="{% url path.to.some_view subjectid=id action=action %}">your link</a>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top