Datta
Datta

Reputation: 87

Syntax error while creating django model

Im trying to create a django model to get registration for newsletter , while creating model in model.py file im getting the following error

  from __future__ import unicode_literals

  from django.db import models



  def SignUp(models.Model):
       Email = models.EmailField(max_length=254, null = False , blank = False)
       Name  = CharField(max_length= 26, null = False , blank = False, default = 'datta')
       TmieStamp = DateTimeField(auto_now=False, auto_now_add=True)
       def __unicode(self)__:
           return self.Name

The error:

Error:
       File "C:\Users\DattaVamshi\Desktop\env\src\newsletter\models.py", line 7
  def SignUp(models.Model):
                   ^
SyntaxError: invalid syntax

error is in this line "def SignUp(models.Model):"

Pyhon 2.7, Django 1.9

Upvotes: 1

Views: 1133

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599638

You've used def SignUp instead of class SignUp.

Upvotes: 9

Related Questions