Finally it works,
I had to use
comment=ThreadedComment(pk=pk)
comment.delete()
On Saturday, November 7, 2015 at 2:15:34 AM UTC+5:30, sonu kumar wrote:
>
> I can't get it working. currently I am using following snippet for
> deletion
>
> from django_comments.views.moderation import perform_delete
>> from django_comments import get_model
>>
>> pk = request.POST.get("pk")
>> comment = get_object_or_404(get_model(), pk=pk,
>> site__pk=settings.SITE_ID,
>> user=request.user)
>> perform_delete(request, comment)
>>
>>
>
> Can you help to make it working ?
>
> On Thursday, November 5, 2015 at 5:18:13 AM UTC+5:30, Stephen McDonald
> wrote:
>>
>> The count value is based on the code here:
>>
>>
>> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/generic/managers.py#L15-L35
>>
>> That takes the "approved" and "removed" flags into account, but only if
>> the COMMENTS_UNAPPROVED_VISIBLE and/or COMMENTS_REMOVED_VISIBLE are set to
>> True, in order to hide their respective comments, which they aren't by
>> default.
>>
>> The default is to show placeholders for the unapproved/removed comments
>> on the site, with their content replaced with a "waiting for approval" or
>> "removed" message, which has the desired affect of keeping the comment tree
>> intact - so the count accurately reflects the number of *visible* comments.
>>
>> Note that if you change these settings after comments have been made,
>> you'll need to run save() on their related objects to trigger the _count
>> field being recalculated.
>>
>>
>>
>>
>> On Thu, Nov 5, 2015 at 1:10 AM, sonu kumar <[email protected]> wrote:
>>
>>> This may looks confusing, so I am going to explain further.
>>> When we use CommentsField as model field then one extra field is added
>>> to model called as comments_count which holds number of comments for an
>>> object related to model.
>>> When a comment is added then it's value get increased by one. How to
>>> decrease value when a comment is deleted.
>>>
>>>
>>> On Wednesday, November 4, 2015 at 6:19:29 PM UTC+5:30, sonu kumar wrote:
>>>>
>>>> When a comment is added to a model then it's comment count get
>>>> incremented automatically. How to do the same in reverse case like when we
>>>> delete a comments then comments count should be decreased by number of
>>>> comments related to given comment and model. Currently I am able to flag a
>>>> comment by setting is_removed set to True. But it's not affecting comments
>>>> count.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.