我正在创建一个网络应用程序,允许用户发布东西,我有一个个人资料部分,我想让用户看到他们发布的东西,所以我在django中使用IF循环。
{% if user_post.author == "request.user.username" %}
hello there {{user_post.title}}
{% else %}
againnn
{{user_post.author}}
{{request.user.username}}
{% endif%}在if循环中,我检查所有的作者,并将他们与登录的用户进行比较。但是它没有执行,在else部分,我正在确认用户的名字。但是else部分正在执行。我不确定是否可以做到这一点,way..if,不,请给我一个建议,谢谢
发布于 2020-08-14 10:53:36
改一下密码怎么样。
{% if user_post.author == "request.user.username" %}至
{% if user_post.author == request.user.username %}https://stackoverflow.com/questions/63404821
复制相似问题