1

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

1 Answer 1

9

You've used def SignUp instead of class SignUp.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.