Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7039087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:45:16+00:00 2026-05-28T01:45:16+00:00

I am using django comment framework. It says it provides a lot of functionality,

  • 0

I am using django comment framework. It says it provides a lot of functionality, and I can also see in the source files that there are various options, but the documentation is a bit poor.

There are two issues

  1. I want to provide a delete button for each comment that is posted, and I don’t want to redirect the user to another page. I just want the comment to be deleted with a confirmation message. I have not found any documentation that tells me how I can do this in the django comments framework
  2. If there is an error while submitting the comment form, the user is redirected to the preview page(that handles errors also), I don’t want this. I want the user to be redirected to the same page, with the appropriate errors. How can I go about doing this.

Any help or direction is appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:45:17+00:00Added an answer on May 28, 2026 at 1:45 am

    There is already a delete view for comments but it is a part of the moderation system. You would need to allow all users the can_moderate permission which would obviously allow them to remove any comment they want (not just theirs). You can quickly write your own view that checks that the comment they are deleting belongs to them:

    from django.shortcuts import get_object_or_404
    from django.contrib.comments.view.moderate import perform_delete
    def delete_own_comment(request, comment_id):
        comment = get_object_or_404(Comment, id=comment_id)
        if comment.user.id != request.user.id:
            raise Http404
        perform_delete(request, comment)
    

    and in your template

    {% for comment in ... %}
    {% if user.is_authenticated and comment.user == user %}
        {% url path.to.view.delete_comment comment_id=comment.id as delete_url %}
        <a href="{{ delete_url }}">delete your comment</a>
    {% endif %}
    {% endfor %}
    

    For the second problem, you can see that the redirection will always happen if there are errors (even if preview=False is set). There aren’t too many workarounds. You could create your own view that wraps the post_comment view (or just write your own post_comment withouth the redirection)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using django comments framework http://docs.djangoproject.com/en/dev/ref/contrib/comments/ Not sure is there option, to make all comments
I am using Django's comment framework which utilizes generic foreign keys. Question: How do
I'm using Django's comments framework . Whenever someone posts a comment he is redirected
I am using the built in comment system with Django but it has started
I am using django-threadedcomments , however the question also applies generally to sorting a
When using Django's built in comment package, where is the table created when the
I am using Django in built comments for allowing users to comment on my
I have Django app that presents a list of items that you can add
I'm considering making something similar to Failblog using Django. That is, a blog where
I am using comment app in django, but currently the sort direction is by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.