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 4008486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:45:39+00:00 2026-05-20T08:45:39+00:00

I am trying to redirect the user back to the page where the comment

  • 0

I am trying to redirect the user back to the page where the comment was posted. I found this post on Django’s site but I am doing something wrong because it won’t redirect back.

Where should the input be placed to have it properly redirected?

{% load comments i18n %}
<form action="{% comment_form_target %}" method="post">{% csrf_token %}
  {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
  {% for field in form %}
    {% if field.is_hidden %}
      {{ field }}
    {% else %}
      {% if field.errors %}{{ field.errors }}{% endif %}
            <input type="hidden" name="next" value="{% url proposal proposal.id %}" />
      <p
        {% if field.errors %} class="error"{% endif %}
        {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}
         {% ifequal field.name "name" %} style="display:none;"{% endifequal %}
         {% ifequal field.name "email" %} style="display:none;"{% endifequal %}
         {% ifequal field.name "url" %} style="display:none;"{% endifequal %}
         {% ifequal field.name "title" %} style="display:none;"{% endifequal %}>
        <!-- {{ field.label_tag }}  -->{{ field }}
      </p>
    {% endif %}
  {% endfor %}
  <p class="submit">
    <!-- <button><input type="submit" name="post" value="{% trans "Send" %}" /></button> -->
        <button type="submit">Send</button>
    <!-- <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> -->
  </p>
</form>
  • 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-20T08:45:40+00:00Added an answer on May 20, 2026 at 8:45 am

    Maybe you don’t need to check for next variable in your template. You could try changing:

    {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
    

    to just:

    <input type="hidden" name="next" value="/added/comment/page/" />
    

    In case you use views.py, redirecting from there seems more obvious, at least for me, as it helps keep the concern away from the template:

    from django.http import HttpResponseRedirect
    HttpResponseRedirect("/path/to/redirect")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to redirect this page Page to a Jquery mobile website that I'm
I'm trying to redirect users back to a page that they were trying to
This is probably one of those easy questions.. I'm trying to redirect the user
So far, my HTTP_REFERER redirect script looks something like this on a page where
I am trying to redirect a login page to an external security service. This
I am trying to redirect ALL requests for mydomain.com whether they are something like:
I'm trying to redirect to a .php page if the $validForm variable is TRUE.
I'm trying to use url_for(:back) to create a redirect leading back to a previous
I am trying to save the http_referer so I can send the user back
I'm trying to get a Formmail form to re-direct back to it's own page.

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.