TemplateSyntaxError at /blogapp/author/1/ 无法解析其余部分:'==user.username'来自“request.user==user.username”
我们可以在 {% %} 中使用什么? 模板错误: 在模板 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论