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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:42:59+00:00 2026-06-19T03:42:59+00:00

I am a newbie at Django. Got Django 1.4.2 working with Python 2.7 on

  • 0

I am a newbie at Django.
Got Django 1.4.2 working with Python 2.7
on Windows 7.

I am following a tutorial and I need to get a form template appear
with radio buttons. Selecting a button sends data and the page should
ask you if you want to ‘vote again?’. Also, if you do not select a button
and submit the form it should show a message asking you to make a choice.

So far,
here’s the HTML form:

<h1>{{ poll.question }}</h1>

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

<form action="{% url 'polls:vote' poll.id %}" method="post">
{% csrf_token %}
{% for choice in poll.choice_set.all %}
    <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" />
    <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br />
{% endfor %}
<input type="submit" value="Vote" />
</form>

Now when I type http://localhost:8000/polls/1/ I should get the form, but instead I get the following error message:

NoReverseMatch at /polls/1/
u"'polls" is not a registered namespace

I registered polls as a namespace, see below in the project urls.py:

from django.conf.urls import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^polls/', include('polls.urls', namespace="polls")),
    url(r'^admin/', include(admin.site.urls)),
)

To answer cathy’s kind request, here’s the vote url:

from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
    url(r'^$', views.index, name='index'),
    # ex: /polls/5/
    url(r'^(?P<poll_id>\d+)/$', views.detail, name='detail'),
    # ex: /polls/5/results/
    url(r'^(?P<poll_id>\d+)/results/$', views.results, name='results'),
    # ex: /polls/5/vote/
    url(r'^(?P<poll_id>\d+)/vote/$', views.vote, name='vote'),
)

.. and below I include the project folder’s urls if this could help:

from django.conf.urls import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^polls/', include('polls.urls', namespace="polls")),
    url(r'^admin/', include(admin.site.urls)),
    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

)

And I just noticed the following error message shown on the browser (because Debug = True):

Error during template rendering

In template C:\Python27\Scripts\mysite\mytemplates\polls\index.html, error at line 4

u"'polls" is not a registered namespace
    {% if latest_poll_list %}
        <ul>
        {% for poll in latest_poll_list %}
            <li><a href="{% url 'polls:detail' poll.id %}">{{ poll.question }}</a></li>
        {% endfor %}
        </ul>
    {% else %}
        <p>No polls are available.</p>
    {% endif %} 

Any help to make that form run properly will be 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-06-19T03:43:00+00:00Added an answer on June 19, 2026 at 3:43 am
    urlpatterns = patterns('polls.views',
        url(r'^$', 'index', name='index'),
        url(r'^(?P<poll_id>\d+)/$', 'detail', name='detail'),
        url(r'^(?P<poll_id>\d+)/results/$', 'results', name='results'),
        url(r'^(?P<poll_id>\d+)/vote/$', 'vote', name='vote'),
    )
    
    {% url polls:detail poll.id %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a python newbie. i was trying out a django tutorial and got
I am a python/django newbie following along this tutorial on dotcloud . I git
I am newbie working with django. I need simple example. How to submit form
Django newbie here. Following the documentation , I am trying the following to get
I am a Python and Django newbie working on a Django app and I
I'm a complete newbie to Django. I've been trying to get it working on
Hello Im a django/python newbie and need some help understanding the code below. def
Django Newbie working on a form to collect information for a carpool app. In
I'm a Django newbie, I am following a tutorial and I had to create
PostgreSQL / Django / newbie here. I've got a bunch of JSON data with

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.