Note that there are some explanatory texts on larger screens.

plurals
  1. POPython error: The view form.formapp.views.contact didn't return an HttpResponse object. solve
    primarykey
    data
    text
    <p>I'm newbie in python and I'm working with a form by using views,urls... my project name is <em>projec1</em> and my application name is <em>usersapp</em> </p> <p>This is my **usersapp/views.py **</p> <pre><code>from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext from users.form import ContactForm def contact(request): if request.method == "POST": contact_form = ContactForm(request.POST) if contact_form.is_valid(): success = True username = contact_form.cleaned_data['username'] password = contact_form.cleaned_data['password'] else: contact_form = ContactForm() return render_to_response('contact.html', {'contact_form': contact_form}) </code></pre> <p>this is my <strong>usersapp/contact.html</strong></p> <pre><code>{%block title%} Contact {%endblock%} {%block content%} &lt;h2&gt;Contact&lt;/h2&gt; &lt;form action ='.' method = 'POST'&gt; {{contact_form.as_p}} &lt;input type ="Submit" name = "submit" value = "send"&gt; &lt;/form&gt; {%endblock%} </code></pre> <p>this is my <strong>usersapp/form.py</strong></p> <pre><code>from django import forms class ContactForm(forms.Form): username = forms.CharField() password = forms.CharField() </code></pre> <p>this is my <strong>projec1/urls.py</strong></p> <pre><code> from django.conf.urls import patterns, include, url from django.conf.urls.defaults import * from users.views import login from users.views import contact urlpatterns = patterns('', ('^contact/$', contact), ) </code></pre> <p>im facing this error </p> <pre><code> TypeError at / Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.4.3 Exception Type: TypeError Exception Value: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) </code></pre> <p>my error is:</p> <pre><code> NameError at /contact name 'forms' is not defined Request Method: GET Request URL: http://127.0.0.1:8000/contact Django Version: 1.4.3 Exception Type: NameError Exception Value: name 'forms' is not defined Exception Location: C:\Users\Documents\MyProjects\projec1\users\form.py in&lt;module&gt;,line 2 Python Executable: C:\Python27\python.exe </code></pre> <p>plz guide someone , thank you in advance </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload