user3654181
user3654181

Reputation: 461

Invalid syntax error in Django form class

SyntaxError at /
invalid syntax (forms.py, line 5)
Request Method: POST
Request URL:    http://127.0.0.1:8000/
Django Version: 1.6.1
Exception Type: SyntaxError
Exception Value:    
invalid syntax (forms.py, line 5)
ExceptionLocation: C:\Users\chiragbagla\Desktop\skillshare\src\signups\views.py in <module>, line 5
Python Executable:  C:\Users\chiragbagla\Desktop\skillshare\Scripts\python2.exe
Python Version: 2.7.9

A part of my view.py code is as follows

from django.shortcuts import render, render_to_response, RequestContext

# Create your views here.

from .forms import SignUpForm

def home(request):

form = SignUpForm(request.POST or None)

if form.is_valid():
    save_it = form.save(commit=False)
    save_it.save()

return render_to_response("signup.html", locals(), context_instance=RequestContext(request))

A part of my forms.py code is as follows

from django import forms

from .models import SignUp

class SignUpForm(forms.ModelForm):
    class meta:
        model=SignUp

A part of my url.py code is as follows

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

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
 url(r'^$', 'signups.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),
)

I want to display sign up form on webpage which I have created using signup.html but the form is not displaying on the webpage of my browser.

So, please tell me where the mistake I am making???

Upvotes: 0

Views: 1694

Answers (1)

rnevius
rnevius

Reputation: 27102

Like the error points out:

class meta:

Should be...

class Meta:

Upvotes: 3

Related Questions