Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#10285 closed (fixed)

Render comment list

Reported by: kylef Owned by: kylef
Component: contrib.comments Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This patch adds the ability to render a comment list directly.

It tries the following templates:

  • "comments/<app>/<model>/list.html",
  • "comments/<app>/list.html",
  • "comments/list.html"

Once it has found a template, it will pass a list of comments. This templatetag stop repetition as many templates I have written are implementing a comment list again and again.

The templatetag can be used like:

{% render_comment_list for [object] %}
{% render_comment_list for [app].[model] [object_id] %}

Attachments (5)

list.html (224 bytes) - added by kylef 5 years ago.
django/contrib/comments/templates/comments/list.html
comments.py (10.6 KB) - added by kylef 5 years ago.
django/contrib/comments/templatestags/comments.py
comments.diff (2.0 KB) - added by kylef 5 years ago.
diff of svn revosopm 9844 against my changes
templatetag_tests.diff (640 bytes) - added by kylef 5 years ago.
Diff for django/trunk/tests/regressiontests/comment_tests/tests/templatetag_tests.py at rev 8557
render_comment_list.diff (4.4 KB) - added by kylef 5 years ago.
Complete diff of all changes

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by kylef

django/contrib/comments/templates/comments/list.html

Changed 5 years ago by kylef

django/contrib/comments/templatestags/comments.py

Changed 5 years ago by kylef

diff of svn revosopm 9844 against my changes

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1 beta
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by kylef

Diff for django/trunk/tests/regressiontests/comment_tests/tests/templatetag_tests.py at rev 8557

comment:2 Changed 5 years ago by mtredinnick

  • Summary changed from Render commet list to Render comment list

comment:3 Changed 5 years ago by jacob

  • milestone changed from 1.1 beta to 1.2

The patch doesn't apply cleanly because it's not in unified diff format, and even when applied by hand the tests fail. Looks like this won't make it into 1.1.

Changed 5 years ago by kylef

Complete diff of all changes

comment:4 Changed 5 years ago by kylef

I have fixed the problem with the tests. I have attached the file render_comment_list.diff, this is the output from the command svn diff.

comment:5 Changed 5 years ago by kylef

Fixed this, on my git repo (git://github.com/kylef/django.git), commit d042fde575d2f28b0d4f155efd1c78269ae2377d

If anyone wants to pull and merge it into svn/django.

comment:6 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [12082]) Fixed #10285 - Added render_comment_list template tag to comments app. Thanks Kyle Fuller for the patch.

comment:7 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.