Sto usando la finestra 7 E ho Django 1.5 e python 2.7 e sto provando ad eseguire l'esempio Django sul proprio sito Web usando la sintassi data ma quando eseguo il comando: >>>from polls.models import Poll, Choice
Ottengo la sintassi:
Erro: G:pmysite>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
il mio modello:
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)
Sono nuovo in Python, ogni aiuto è apprezzato.
risposte:
3 per risposta № 1Questo è solo un refuso: usa from
invece di form
.