Opened 8 years ago

Closed 6 years ago

#16524 closed New feature (wontfix)

Add a manager/queryset method in contrib.comments to fetch comments not in moderation

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


django.contrib.comments has a query to fetch all comments that are not in moderation, i.e. all the "publicly viewable" comments.
It's hidden inside the BaseCommentNode class in templatetags/comments though, which means developers using django.contrib.comments wanting to fetch publicly viewable comments outside of a templatetag context must violate DRY and copy/paste the filters themselves.

Attached is a patch that moves this code to a manager/queryset method, and that pass all current tests. It also makes possible to use the other manager methods (in_moderation, for_model) as queryset methods.

Attachments (2)

comments-add-queryset-methods.diff (3.6 KB) - added by Mathieu Pillard 8 years ago.
16524.diff (4.6 KB) - added by Justin Lilly 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by Mathieu Pillard

comment:1 Changed 8 years ago by Mathieu Pillard

Has patch: set

comment:2 Changed 8 years ago by Justin Lilly

Owner: changed from nobody to anonymous
Status: newassigned
Triage Stage: UnreviewedReady for checkin

Added a pull request.

@mat, in the future, your diffs should be relative to the repository root (ie: the folder with a django and tests folder in it).

comment:3 Changed 8 years ago by Jannis Leidel

Needs documentation: set
Needs tests: set
Triage Stage: Ready for checkinAccepted
Type: UncategorizedNew feature

Please also attach an up-to-date patch with your changes. Also needs docs and tests.

comment:4 Changed 8 years ago by Mathieu Pillard

Sadly, I currently lack the time to finish/improve my patch. If someone wants to work on this, feel free!

Changed 8 years ago by Justin Lilly

Attachment: 16524.diff added

comment:5 Changed 8 years ago by Justin Lilly

Needs documentation: unset
Needs tests: unset
Owner: changed from anonymous to Justin Lilly
Status: assignednew

Most of the tests for comment managers still apply here. The current documentation still applies. If you can make a more targeted suggestion for which docs to provide, I'll happily add them, but I think the current document is adequate.

comment:6 Changed 8 years ago by Jannis Leidel

Needs documentation: set

You add several model manager methods which simply need to be documented to be of any use.

comment:7 Changed 6 years ago by Jacob

Resolution: wontfix
Status: newclosed

django.contrib.comments has been deprecated and is no longer supported, so I'm closing this ticket. We're encouraging users to transition to a custom solution, or to a hosted solution like Disqus.

The code itself has moved to; if you want to keep using it, you could move this bug over there.

Note: See TracTickets for help on using tickets.
Back to Top