繁体   English   中英

Django中的模型定义调试

[英]model definition debug in django

我的模型定义如下,当我运行python manage.py sql应用程序时,它什么也没有。 我的应用程序名称是application。 当我将模型的内容更改为教程https://docs.djangoproject.com/en/1.5/intro/tutorial01/时 ,它带有正确的sql语句,因此在下面的模型中必须有一些错误,任何人都可以指出出来吗

class Applicationinfo(models.Model):
    applicationinfo_id = models.BigIntegerField(primary_key=True, db_column='ApplicationInfo_id') # Field name made lowercase.
    mainproduct = models.CharField(max_length=300, db_column='MainProduct') # Field name made lowercase.
    subproduct = models.CharField(max_length=300, db_column='SubProduct') # Field name made lowercase.
    appname = models.CharField(max_length=300, db_column='AppName') # Field name made lowercase.
    employee = models.CharField(max_length=48, db_column='Employee') # Field name made lowercase.
    employeeid = models.CharField(max_length=24, db_column='Employeeid') # Field name made lowercase.
    applicantmail = models.CharField(max_length=90, db_column='applicantMail') # Field name made lowercase.
    mailnotifytimes = models.IntegerField(db_column='MailNotifyTimes') # Field name made lowercase.                                                                                                          
    applicantim = models.CharField(max_length=48, db_column='ApplicantIM') # Field name made lowercase.
    applicantmobilephone = models.CharField(max_length=33, db_column='ApplicantMobilephone') # Field name made lowercase.
    messagenotifytimes = models.IntegerField(db_column='MessageNotifyTimes') # Field name made lowercase.
    applicantdpt = models.CharField(max_length=300, db_column='ApplicantDPT') # Field name made lowercase.
    applicationdate = models.DateTimeField(db_column='ApplicationDate') # Field name made lowercase.
    onlinestorid = models.CharField(max_length=30, db_column='OnlineStorID') # Field name made lowercase.
    appid = models.BigIntegerField(unique=True, db_column='AppID') # Field name made lowercase.
    tapesavecopies = models.IntegerField(null=True, db_column='TapeSaveCopies', blank=True) # Field name made lowercase.
    appowner = models.CharField(max_length=48, db_column='AppOwner', blank=True) # Field name made lowercase.
    appownermail = models.CharField(max_length=96, db_column='AppOwnerMail', blank=True) # Field name made lowercase.
    subproductowner = models.CharField(max_length=48, db_column='SubProductOwner', blank=True) # Field name made lowercase.
    subproductownermail = models.CharField(max_length=96, db_column='SubProductOwnerMail', blank=True) # Field name made lowercase.
    mainproductowner = models.CharField(max_length=48, db_column='MainProductOwner', blank=True) # Field name made lowercase.
    mainproductownermail = models.CharField(max_length=96, db_column='MainProductOwnerMail', blank=True) # Field name made lowercase.
    applicationreason = models.CharField(max_length=500, db_column='ApplicationReason', blank=True)
    filetype = models.BooleanField(db_column='FileType')
    applicationstatus = models.IntegerField(db_column='ApplicationStatus')

    class Meta:
        db_table = 'applicationinfo'
        app_label = 'backupcenter1'

app_label设置为'backupcenter1' ,将其删除。

app_label = 'backupcenter1'意味着,据Django所知,该模型不属于您的application程序application程序,而是属于backupcenter1应用程序。 因此,为什么它不显示在application程序application程序的SQL输出中。


另外,请注意, applicationapplication的糟糕名称,您可能需要更改它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM