Masoud Motallebipour
Masoud Motallebipour

Reputation: 414

Django Syntax Error over form polls.models import

I'm using window 7 And I have Django 1.5 and python 2.7 and trying to run the Django sample on it's own website Using the given syntax but when I run the command: >>>from polls.models import Poll, ChoiceI get the syntax:

Erro: G:\p\mysite>python manage.py shell Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information.(InteractiveConsole)
>>> help Type help() for interactive help, or help(object) for help about object.
>>> form polls.models import Poll   File "<console>", line 1
    form polls.models import Poll
             ^ SyntaxError: invalid syntax

my model:

from django.db import models
class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)

I'm new at python, any help is appreciated.

Upvotes: 0

Views: 1046

Answers (1)

alecxe
alecxe

Reputation: 474001

This is just a typo: use from instead of form.

Upvotes: 3

Related Questions