-2

这是我的代码,我收到此错误

root@ubuntu:~/public_html/todolist# ./manage.py sql todo
SyntaxError: invalid syntax (models.py, line 28)

编码:

from django.db import models

# Create your models here.

class Todo(models.model):
    name = models.CharField('Name',
    max_lenght =200,
    help_text = 'Enter the project name'                                    )

def __unicode__(self):
    return self.name

class Meta:
    ordering = ('name',)

class TodoArticulo (models.Model):
    fktodo = models.ForeignKey(Todo)
    task = models.TextField('Task', help_text= ' Task Descripcion')
    date = models.DateField()

def __unicode__(self):
    return u'%s | %s' % (self.fktodo, self.task)

class Meta:
    verbose_name=  u 'Todo Task'
    verbose_name_plural= 'Todo Tasks'
4

1 回答 1

2

首先,您发布的内容没有 28 行。

无论如何,在定义 verbose_name 的行中, u 和字符串之间不应有空格:

>>> u 'Todo Task'
  File "<stdin>", line 1
    u 'Todo Task'
                ^
SyntaxError: invalid syntax
>>> u'Todo Task'
u'Todo Task'
于 2013-09-14T13:09:03.480 回答