Django模型ValueError中的错误

时间:2015-05-31 09:55:38

标签: python django django-models

我在运行python manage.py syncdbpython manage.py migrate

时遇到此错误

该模型工作正常,但后来我尝试添加另一个模型对象,并在运行migrate commond时显示错误。

所以我恢复原来的models.py但它仍然显示错误。

我的项目的models.py如下:

from django.db import models
from django.conf import settings


class Assignment(models.Model):
    main_sub     = models.CharField(max_length="60", choices=settings.SUBJECTS_LIST, default ='sub1')
    add_sub      = models.CharField(max_length="60", choices=settings.SUBJECTS_LIST, default ='sub1')
    deadline     = models.CharField(max_length="60", choices=settings.DUE_TIME_LIST, default ='12 hours')
    details      = models.TextField()
    timestamp    = models.DateTimeField(auto_now_add=True, auto_now=False)
    username     = models.CharField(max_length="60")

    def __unicode__(self):
        return self.username

并且在运行syncdb输出时是:

http://pastebin.com/zFp2mz1Z

我查找了与此错误相关的其他问题,但没有任何帮助。

SUBJECTS_LIST和DUE_TIME_LIST元组:

#dropdown for subjects
SUBJECTS_LIST = (
        ( 'sub1', 'Subject1' ),
        ( 'sub2', 'Subject2' ),
        ( 'sub3','Subject3' ),
    )

#DROPDOWN FOR DUE_TIME
DUE_TIME_LIST = (
        ( '12 hours', '12 hours' ),
        ( '24 hours', '24 hours' ),
        ( '2 days','2 days' ),
        ( '3 days','3 days' ),
        ( '4 days','4 days' ),
        ( '5 days','5 days' ),
        ( '6 days','6 days' ),
        ( '1 week','1 week' ),
        ( 'More than 1 week','More than 1 week' ),
    )

0 个答案:

没有答案