英文:
How can I display only selected options of a fild type ManyToMany - django
问题
早上好,我需要在我将用HTML构建的表格中显示名为“sfide”的ManyToMany字段中选择的值,我该如何做?谢谢。
我还附上了“Profilo”类的图像,其中包含ManyToMany字段“sfide”。查看图片描述
英文:
Good morning, I need to display the values selected in the manytomany field named "sfide" in a table I will build with html, how can I do it? thanks
I also attach the image of the class "Profilo" with the ManyToMany field "sfide"
enter image description here
答案1
得分: 0
我找到了答案:
<table>
<tr>
<td>
<h4>挑战选择</h4>
</td>
</tr>
{% for sfida in user.profile.sfide.all %}
<tr>
<td>{{ sfida.sfida }}</td>
</tr>
{% endfor %}
</table>
英文:
I found the answer:
<table>
<tr>
<td>
<h4>Sfide Scelte</h4>
</td>
</tr>
{% for sfida in user.profile.sfide.all %}
<tr>
<td>{{ sfida.sfida }}</td>
</tr>
{% endfor %}
</table>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论