TemplateSyntaxError at /blogapp/author/1/ 无法解析其余部分:'==user.username'来自“request.user==user.username”

发布于 2025-01-17 23:29:55 字数 1046 浏览 4 评论 0原文

我们可以在 {% %} 中使用什么? 模板错误: 在模板 C:\Users\SHAFQUET NAGHMI\blog\blogapp\templates\blogapp\authorview.html 中,第 7 行出现错误 无法解析其余部分:“request.user==user.username”中的“==user.username”

1 : {% include 'blogapp/home.html' %}
   2 : {% load static %}
   3 : {% block content %}
   4 : <link rel="stylesheet" href="{% static 'blogapp/authorview.css' %}">
   5 : <!-- Latest compiled and minified CSS -->
   6 : <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
   7 :  {% if request.user==user.username %} 
   8 : {{user.username}}
   9 : {% endif %}
   10 : <h1>{{user.username}}</h1>
   11 : <!-- <h1>{{request.user}}</h1>-->
   12 : {% for post in a %}
   13 : <div >
   14 :     <div class="container">
   15 :       <h2 class="display-1">{{post.title}} </h2>
   16 :       <p class="display-2">{{post.summary}}</p><br>
   17 :       <p class="display-2">{{post.Newpost}}</p>

what can we use inside {% %} ?
Template error:
In template C:\Users\SHAFQUET NAGHMI\blog\blogapp\templates\blogapp\authorview.html, error at line 7
Could not parse the remainder: '==user.username' from 'request.user==user.username'

1 : {% include 'blogapp/home.html' %}
   2 : {% load static %}
   3 : {% block content %}
   4 : <link rel="stylesheet" href="{% static 'blogapp/authorview.css' %}">
   5 : <!-- Latest compiled and minified CSS -->
   6 : <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
   7 :  {% if request.user==user.username %} 
   8 : {{user.username}}
   9 : {% endif %}
   10 : <h1>{{user.username}}</h1>
   11 : <!-- <h1>{{request.user}}</h1>-->
   12 : {% for post in a %}
   13 : <div >
   14 :     <div class="container">
   15 :       <h2 class="display-1">{{post.title}} </h2>
   16 :       <p class="display-2">{{post.summary}}</p><br>
   17 :       <p class="display-2">{{post.Newpost}}</p>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文