Opened 13 years ago

Closed 11 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: dev
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

Description

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 13 years ago.
16524.diff (4.6 KB ) - added by Justin Lilly 13 years ago.

Download all attachments as: .zip

Change History (9)

by Mathieu Pillard, 13 years ago

comment:1 by Mathieu Pillard, 13 years ago

Has patch: set

comment:2 by Justin Lilly, 13 years ago

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

https://github.com/django/django/pull/31

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 by Jannis Leidel, 13 years ago

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 by Mathieu Pillard, 13 years ago

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

by Justin Lilly, 13 years ago

Attachment: 16524.diff added

comment:5 by Justin Lilly, 13 years ago

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 by Jannis Leidel, 13 years ago

Needs documentation: set

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

comment:7 by Jacob, 11 years ago

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 https://github.com/django/django-contrib-comments; 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