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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:36:41+00:00 2026-06-10T08:36:41+00:00

Code from views.py: def feedback(request): if request.method == POST: form = CommentForm(request.POST) if form.is_valid():

  • 0

Code from views.py:

def feedback(request):
    if request.method == "POST":
        form = CommentForm(request.POST)
        if form.is_valid():
            form.save()
        else:
            print("form.errors:", form.errors)
    else:
        form = CommentForm()
    articles = Comment.objects.all()
    ResponseDict = {"articles": articles, "form": form}
    return render_to_response("feedback.html", ResponseDict, 
        context_instance = RequestContext(request))

I’ve tried this and several modifications from answers to similar questions, but nothing works. When I press submit button, all form fields in html become empty.

EDIT: code from feedback.html:

{% extends "base.html" %}
{% block main %}
    <table>
        <form action="/feedback/" method="POST">
            {% csrf_token %}
            <div class="article">
                <label for="name">
                    Ваше имя:
                </label>
                <br />
                <input type="text" name="name" id="name" size="40" class="inputbox" value="" />
                <br />
                <!-- class="inputbox required" -->
                <textarea class="WithoutTinymce" cols="50" rows="10" name="text" id="text"></textarea>
                <br />
                <input type="submit" name="submit" value="Отправить">
            </div> <!-- /article -->
        </form>
    </table>
    {% include "articles.html" %}
{% endblock %}

I can also paste code from base.html if needed.

EDIT2: minimized code from base.html:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
...
<body id="body-id" onload="loaded()">

<!-- Main -->
<div id="main" class="box">
    <div id="page" class="box">
        <div id="page-in" class="box">
            <!-- Content -->
            <div id="content">
                {% block main %}
                {% endblock %}
                <hr class="noscreen" />
            </div> <!-- /content -->
        </div> <!-- /page-in -->
    </div> <!-- /page -->
</div> <!-- /Main -->
</body>
</html>
  • 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-06-10T08:36:43+00:00Added an answer on June 10, 2026 at 8:36 am

    In your template you are not making use of form passed by the view.

    You can update part of your template as (assuming your field names in the form are first_field and second_field.

    <form action="/feedback/" method="POST">
        {% csrf_token %}
        <div class="article">
            <label for="name">
                Ваше имя:
            </label>
            <br />
            {{ form.first_field.errors }}
            {{ form.first_field.label_tag }}: {{ form.first_field }}
            <br />
            <!-- class="inputbox required" -->
            {{ form.second_field.errors }}
            {{ form.second_field.label_tag }}: {{ form.second_field }}
            <br />
            <input type="submit" name="submit" value="Отправить">
        </div> <!-- /article -->
    </form>
    

    For more reference – Displaying form using template

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

Sidebar

Related Questions

I have the following view in my views.py: def MoveSucessfulEntries(request): if request.method == 'POST':
here is my code: urls.py: from django.conf.urls import patterns from views import show,showpage urlpatterns
my views.py file code: #!/usr/bin/python from django.template import loader, RequestContext from django.http import HttpResponse
I am using the following code to save values from a settings view that
views.py: def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' tempToken =
Here is the relevant code from views/products/edit.html.erb : <%= form_for(:product, :url => {:action =>
I take code from Subdomain RailsCast module UrlHelper def with_subdomain(subdomain) subdomain = (subdomain ||
My views.py code: from django.template import Context, loader, RequestContext from django.http import HttpResponse from
Consider the following code from index view: <td> <%= 'foo' if bar == BAZ
the following code (from a database object created for each new view): -(void)update:(NSString *)queryText{

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.