djangobb之debug-toolbar查看其sql

时间:2022-06-16 22:02:37

#djangobb之views  show_forum(request, forum_id, full=True)

    default
16.00 ms (21 queries including 15 duplicates ) Query Timeline Time (ms) Action
-
SELECT
"djangobb_forum_forum"."id",
"djangobb_forum_forum"."category_id",
"djangobb_forum_forum"."name",
"djangobb_forum_forum"."position",
"djangobb_forum_forum"."description",
"djangobb_forum_forum"."updated",
"djangobb_forum_forum"."post_count",
"djangobb_forum_forum"."topic_count",
"djangobb_forum_forum"."last_post_id",
"djangobb_forum_forum"."forum_logo" FROM "djangobb_forum_forum" WHERE "djangobb_forum_forum"."id" = ''
#查找id=1的forum Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(338)
forum = get_object_or_404(Forum, pk=forum_id) -
SELECT
"djangobb_forum_category"."id",
"djangobb_forum_category"."name",
"djangobb_forum_category"."position"
FROM "djangobb_forum_category" WHERE "djangobb_forum_category"."id" = ''
#查找id=1的类别 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(339)
if not forum.category.has_access(request.user): -
SELECT (1) AS "a" FROM "auth_group" INNER JOIN "djangobb_forum_category_groups" ON ("auth_group"."id" = "djangobb_forum_category_groups"."group_id") WHERE "djangobb_forum_category_groups"."category_id" = '' LIMIT 1 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(339)
if not forum.category.has_access(request.user):
C:\djbb\mybb\djangobb_forum/models.py in has_access(80)
if self.groups.exists(): -
SELECT
"auth_user"."id",
"auth_user"."password",
"auth_user"."last_login",
"auth_user"."is_superuser",
"auth_user"."username",
"auth_user"."first_name",
"auth_user"."last_name",
"auth_user"."email",
"auth_user"."is_staff",
"auth_user"."is_active",
"auth_user"."date_joined"
FROM "auth_user" INNER JOIN "djangobb_forum_forum_moderators" ON ("auth_user"."id" = "djangobb_forum_forum_moderators"."user_id") WHERE "djangobb_forum_forum_moderators"."forum_id" = ''
#查找出该版块的所有版主 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(343)
request.user in forum.moderators.all() -
SELECT "djangobb_forum_category"."id",
"djangobb_forum_category"."name",
"djangobb_forum_category"."position"
FROM "djangobb_forum_category" ORDER BY "djangobb_forum_category"."position" ASC Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(346)
for category in Category.objects.all(): -
SELECT (1) AS "a" FROM "auth_group" INNER JOIN "djangobb_forum_category_groups" ON ("auth_group"."id" = "djangobb_forum_category_groups"."group_id") WHERE "djangobb_forum_category_groups"."category_id" = '' LIMIT 1
Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(347)
if category.has_access(request.user):
C:\djbb\mybb\djangobb_forum/models.py in has_access(80)
if self.groups.exists(): -
SELECT (1) AS "a" FROM "auth_group" INNER JOIN "djangobb_forum_category_groups" ON ("auth_group"."id" = "djangobb_forum_category_groups"."group_id") WHERE "djangobb_forum_category_groups"."category_id" = '' LIMIT 1
Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(347)
if category.has_access(request.user):
C:\djbb\mybb\djangobb_forum/models.py in has_access(80)
if self.groups.exists(): -
SELECT (1) AS "a" FROM "auth_group" INNER JOIN "djangobb_forum_category_groups" ON ("auth_group"."id" = "djangobb_forum_category_groups"."group_id") WHERE "djangobb_forum_category_groups"."category_id" = '' LIMIT 1
Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(347)
if category.has_access(request.user):
C:\djbb\mybb\djangobb_forum/models.py in has_access(80)
if self.groups.exists(): -
SELECT COUNT(*) AS "__count" FROM "djangobb_forum_topic" WHERE "djangobb_forum_topic"."forum_id" = '' Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(354)
'topics_page': get_page(topics, request, forum_settings.FORUM_PAGE_SIZE),
C:\djbb\mybb\djangobb_forum/util.py in get_page(40)
return Paginator(objects, size).page(request.GET.get('page', 1)) -
SELECT "djangobb_forum_topic"."id",
"djangobb_forum_topic"."forum_id",
"djangobb_forum_topic"."name",
"djangobb_forum_topic"."created",
"djangobb_forum_topic"."updated",
"djangobb_forum_topic"."user_id",
"djangobb_forum_topic"."views",
"djangobb_forum_topic"."sticky",
"djangobb_forum_topic"."closed",
"djangobb_forum_topic"."post_count",
"djangobb_forum_topic"."last_post_id",
"djangobb_forum_forum"."id",
"djangobb_forum_forum"."category_id",
"djangobb_forum_forum"."name",
"djangobb_forum_forum"."position",
"djangobb_forum_forum"."description",
"djangobb_forum_forum"."updated",
"djangobb_forum_forum"."post_count",
"djangobb_forum_forum"."topic_count",
"djangobb_forum_forum"."last_post_id",
"djangobb_forum_forum"."forum_logo",
"djangobb_forum_category"."id",
"djangobb_forum_category"."name",
"djangobb_forum_category"."position",
"auth_user"."id",
"auth_user"."password",
"auth_user"."last_login",
"auth_user"."is_superuser",
"auth_user"."username",
"auth_user"."first_name",
"auth_user"."last_name",
"auth_user"."email",
"auth_user"."is_staff",
"auth_user"."is_active",
"auth_user"."date_joined" FROM "djangobb_forum_topic" INNER JOIN "djangobb_forum_forum" ON ("djangobb_forum_topic"."forum_id" = "djangobb_forum_forum"."id") INNER JOIN "djangobb_forum_category" ON ("djangobb_forum_forum"."category_id" = "djangobb_forum_category"."id") INNER JOIN "auth_user" ON ("djangobb_forum_topic"."user_id" = "auth_user"."id") WHERE "djangobb_forum_topic"."forum_id" = '' ORDER BY "djangobb_forum_topic"."sticky" DESC, "djangobb_forum_topic"."updated" DESC LIMIT 4 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 34
{% for topic in topics_page %}
35
<tr>
36
<td class="tcl">
37
<div class="intd">
38
<div {% if topic.sticky %}class="sticky"{% else %}{% if topic.closed %}class="closed"{% else %}{% if topic|has_unreads:user %}class="inew"{% else %}class="icon"{% endif %}{% endif %}{% endif %}><div class="nosize"><!-- --></div></div> C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_post"."id",
"djangobb_forum_post"."topic_id",
"djangobb_forum_post"."user_id",
"djangobb_forum_post"."created",
"djangobb_forum_post"."updated",
"djangobb_forum_post"."updated_by_id",
"djangobb_forum_post"."markup",
"djangobb_forum_post"."body",
"djangobb_forum_post"."body_html",
"djangobb_forum_post"."user_ip" FROM "djangobb_forum_post" WHERE "djangobb_forum_post"."id" = ''
Duplicated 4 times. Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "auth_user"."id",
"auth_user"."password",
"auth_user"."last_login",
"auth_user"."is_superuser",
"auth_user"."username",
"auth_user"."first_name",
"auth_user"."last_name",
"auth_user"."email",
"auth_user"."is_staff",
"auth_user"."is_active",
"auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_post"."id", "djangobb_forum_post"."topic_id", "djangobb_forum_post"."user_id", "djangobb_forum_post"."created", "djangobb_forum_post"."updated", "djangobb_forum_post"."updated_by_id", "djangobb_forum_post"."markup", "djangobb_forum_post"."body", "djangobb_forum_post"."body_html", "djangobb_forum_post"."user_ip" FROM "djangobb_forum_post" WHERE "djangobb_forum_post"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_post"."id", "djangobb_forum_post"."topic_id", "djangobb_forum_post"."user_id", "djangobb_forum_post"."created", "djangobb_forum_post"."updated", "djangobb_forum_post"."updated_by_id", "djangobb_forum_post"."markup", "djangobb_forum_post"."body", "djangobb_forum_post"."body_html", "djangobb_forum_post"."user_ip" FROM "djangobb_forum_post" WHERE "djangobb_forum_post"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_post"."id", "djangobb_forum_post"."topic_id", "djangobb_forum_post"."user_id", "djangobb_forum_post"."created", "djangobb_forum_post"."updated", "djangobb_forum_post"."updated_by_id", "djangobb_forum_post"."markup", "djangobb_forum_post"."body", "djangobb_forum_post"."body_html", "djangobb_forum_post"."user_ip" FROM "djangobb_forum_post" WHERE "djangobb_forum_post"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = ''
Duplicated 4 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 50
</td>
51
<td class="tc2">{{ topic.reply_count }}</td>
52
<td class="tc3">{{ topic.views }}</td>
53
<td class="tcr"><a href="{{ topic.last_post.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
54
</tr>
55
{% empty %}
56
<tr><td class="djangobbcon1" colspan="4">{% trans "Forum is empty." %}</td></tr>
57
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_forum"."id", "djangobb_forum_forum"."category_id", "djangobb_forum_forum"."name", "djangobb_forum_forum"."position", "djangobb_forum_forum"."description", "djangobb_forum_forum"."updated", "djangobb_forum_forum"."post_count", "djangobb_forum_forum"."topic_count", "djangobb_forum_forum"."last_post_id", "djangobb_forum_forum"."forum_logo" FROM "djangobb_forum_forum" WHERE "djangobb_forum_forum"."category_id" = '' ORDER BY "djangobb_forum_forum"."position" ASC
Duplicated 3 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 79
<select name="id" id="forum_id" onchange="window.location=('{% url 'djangobb:index' %}'+this.options[this.selectedIndex].value)">
80
{% for category in categories %}
81
<optgroup label="{{ category }}">
82
{% for forum in category.forums.all %}
83
<option value="{{ forum.id }}">{{ forum.name }}</option>
84
{% endfor %}
85
</optgroup>
86
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_forum"."id", "djangobb_forum_forum"."category_id", "djangobb_forum_forum"."name", "djangobb_forum_forum"."position", "djangobb_forum_forum"."description", "djangobb_forum_forum"."updated", "djangobb_forum_forum"."post_count", "djangobb_forum_forum"."topic_count", "djangobb_forum_forum"."last_post_id", "djangobb_forum_forum"."forum_logo" FROM "djangobb_forum_forum" WHERE "djangobb_forum_forum"."category_id" = '' ORDER BY "djangobb_forum_forum"."position" ASC
Duplicated 3 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 79
<select name="id" id="forum_id" onchange="window.location=('{% url 'djangobb:index' %}'+this.options[this.selectedIndex].value)">
80
{% for category in categories %}
81
<optgroup label="{{ category }}">
82
{% for forum in category.forums.all %}
83
<option value="{{ forum.id }}">{{ forum.name }}</option>
84
{% endfor %}
85
</optgroup>
86
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html
-
SELECT "djangobb_forum_forum"."id", "djangobb_forum_forum"."category_id", "djangobb_forum_forum"."name", "djangobb_forum_forum"."position", "djangobb_forum_forum"."description", "djangobb_forum_forum"."updated", "djangobb_forum_forum"."post_count", "djangobb_forum_forum"."topic_count", "djangobb_forum_forum"."last_post_id", "djangobb_forum_forum"."forum_logo" FROM "djangobb_forum_forum" WHERE "djangobb_forum_forum"."category_id" = '' ORDER BY "djangobb_forum_forum"."position" ASC
Duplicated 3 times.
0%
0.00 Connection: default C:\djbb\mybb\djangobb_forum/views.py in show_forum(358)
return render(request, 'djangobb_forum/forum.html', to_return) 79
<select name="id" id="forum_id" onchange="window.location=('{% url 'djangobb:index' %}'+this.options[this.selectedIndex].value)">
80
{% for category in categories %}
81
<optgroup label="{{ category }}">
82
{% for forum in category.forums.all %}
83
<option value="{{ forum.id }}">{{ forum.name }}</option>
84
{% endfor %}
85
</optgroup>
86
{% endfor %} C:\djbb\mybb\djangobb_forum\templates\djangobb_forum\forum.html