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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:54:10+00:00 2026-05-28T04:54:10+00:00

i have a django form which generates the qrcode, the form does show up

  • 0

i have a django form which generates the qrcode, the form does show up on the browser however after submitting, it does not render qr_results.html

views.py

from django.template.loader import get_template
from django.template import Template, Context
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from django.core.mail import send_mail
from django.http import HttpResponseRedirect
from cacoos_com.qr.qr_form import QrForm
from pygooglechart import QRChart

def qr(request):
    if request.method == 'POST':
        qform = QrForm(request.POST)
        if qform.is_valid():
            qc = qform.cleaned_data
            chart = QRChart(125,125)
            chart.add_data(qc['url'])
            chart.set_ec('H', 0)
            chart.download('/opt/cacoos_com/media/qr-hello.png')
            render_to_response('qr_results.html', {'url': qc['url']})
    else:
        qform = QrForm(initial={'url': 'type your url here'})
    return render_to_response('qr_form.html', {'form': qform})

qr_form.py

from django import forms

class QrForm(forms.Form):
    url = forms.CharField(max_length=100)

i have not posted the templates here but i think they ok? any idea why this could be happening….

:update

these are the two templates used..

qr_form.py

{% extends "base.html" %}
<html>
<head>
    <title>QR generator</title>
</head>
<body>
{% block content %}
    <h3>QR encoder</h3>

    {% if form.errors %}
        <p style="color: red;">
            Please Correct the error{{ form.errors|pluralize }} below.
        </p>
    {% endif %}

    <form action="" method="POST">
        <div class="field">
            {{ form.url.errors }}
            <label for="id_url">Url:</label>
            {{ form.url }}
        </div>
        <input type="submit" value="Submit">
    </form>

{% endblock %}
</body>
</html>

qr_results.html

{% extends "base.html" %}

{% block content %}
<h3>QR code</h3>

<p> This is the qr code for your url {{ url }} </p>

<p><img src="{{ MEDIA_URL}}/media/qr-hello.png" /"></p>

{% endblock %}
  • 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-28T04:54:11+00:00Added an answer on May 28, 2026 at 4:54 am

    That’s because your view doesn’t return the result of

    render_to_response('qr_results.html', {'url': qc['url']})
    

    It is also a good practice to do a redirect after POST (see http://en.wikipedia.org/wiki/Post/Redirect/Get ).

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

Sidebar

Related Questions

I have django form which displays the check boxes.After selecting the checkboxes user will
I have a Django form which I load dynamically to a jQuery dialog after
I have a Django form that needs to do some client-side validation before submitting
I have a factory method that generates django form classes like so: def get_indicator_form(indicator,
I have a Django app which, submitting a package, should return values that are
I have been struggling to create a django form which users can fill and
I have a Django form with a RegexField , which is very similar to
I have a Django form which I'm validating in a normal Django view. I'm
I have a django form where I have a FileField which accepts user's resume.
I have a Django form with several fields in it one of which needs

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.