June 29, 2023, 10:04 p.m.
lets
intro-Utilities for controlling the font size of an element.
When the COMMENTS_XTD_MAX_THREAD_LEVEL is greater than 0, comments below the maximum thread level may receive replies that will nest inside each other up to the maximum thread level. A comment in a the thread level below the COMMENTS_XTD_MAX_THREAD_LEVEL can show a Reply link that allows users to send nested comments.
In this section we will enable nested comments by modifying COMMENTS_XTD_MAX_THREAD_LEVEL and apply some changes to our blog_detail.html template.
We can make use of two template tags, render_xtdcomment_tree and get_xtdcomment_tree. The former renders a template with the comments while the latter put the comments in a nested data structure in the context of the template.
We will also introduce the setting COMMENTS_XTD_LIST_ORDER, that allows altering the default order in which the comments are sorted in the list. By default comments are sorted by thread and their position inside the thread, which turns out to be in ascending datetime of arrival. In this example we will list newer comments first.
Let’s start by editing tutorial/settings.py to set up the maximum thread level to 1 and a comment ordering such that newer comments are retrieve first:
comment from admin
intro-Utilities for controlling the font size of an element.
Last updated 1 year, 2 months ago
Post your comment
Comment guidelines
We want everyone to feel welcome and comfortable when they interact with our community. Please help us keep comments respectful by using plain English and avoiding phrasing that could be misinterpreted as offensive. You can also help by reporting inappropriate comments.