Django

Code

Ticket #10285 (closed: fixed)

Opened 1 year ago

Last modified 7 months ago

Render comment list

Reported by: kylef Assigned to: kylef
Milestone: 1.2 Component: django.contrib.comments
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

list.html (224 bytes) - added by kylef on 02/17/09 06:19:02.
django/contrib/comments/templates/comments/list.html
comments.py (10.6 kB) - added by kylef on 02/17/09 06:19:45.
django/contrib/comments/templatestags/comments.py
comments.diff (2.0 kB) - added by kylef on 02/17/09 06:21:39.
diff of svn revosopm 9844 against my changes
templatetag_tests.diff (0.6 kB) - added by kylef on 02/28/09 19:27:04.
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 on 03/23/09 19:56:13.
Complete diff of all changes

Change History

02/17/09 06:19:02 changed by kylef

  • attachment list.html added.

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

02/17/09 06:19:45 changed by kylef

  • attachment comments.py added.

django/contrib/comments/templatestags/comments.py

02/17/09 06:21:39 changed by kylef

  • attachment comments.diff added.

diff of svn revosopm 9844 against my changes

02/28/09 12:47:58 changed by jacob

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • milestone set to 1.1 beta.

02/28/09 19:27:04 changed by kylef

  • attachment templatetag_tests.diff added.

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

03/01/09 01:01:43 changed by mtredinnick

  • summary changed from Render commet list to Render comment list.

03/23/09 15:48:32 changed 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.

03/23/09 19:56:13 changed by kylef

  • attachment render_comment_list.diff added.

Complete diff of all changes

03/23/09 19:57:18 changed 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.

06/13/09 10:23:12 changed 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.

01/03/10 20:29:12 changed by jezdez

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #10285 (Render comment list)




Change Properties
Action