django template 질문드립니다
조회수 496회
이 밑에 User Model에서 저 변수들만 출력해서 사용자에게 보여주고 싶은데 혹시 어떻게 해야 하는지 알려주실 수 있을까요
{% for users in object_list %}
<li class="user">{{ user }}</li>
{% endfor %}
이렇게 하면 모든 정보를 다 가져오지 않을까요ㅠㅠ?
-
(•́ ✖ •̀)
알 수 없는 사용자
1 답변
-
#django object_list = [[user1,id,etc],[user2,id,etc],[user3,id,etc]] #[username,id,etc] return render(......, {"object_list":object_list}
<!-- jinja2 template --> <table> <tr> <th>username</th> <th>userid</th> <th>etc</th> </tr> {% for user in object_list %} <tr> <td>{{user[0]}}</td> <td>{{user[1]}}</td> <td>{{user[2]}}</td> </tr> {% endfor %} </table>
댓글 입력