为什么我得到列main_category.parent_cat_id不存在

时间:2016-04-09 16:40:13

标签: python django database amazon-web-services elastic-beanstalk

所以在开发过程中每件事都运行正常,但是一旦我进行eb部署,这个问题就会再次发生。我的代码中没有related_cat。

  ProgrammingError at /admin/main/category/
column main_category.parent_cat_id does not exist
LINE 1: ...n_category"."author_id", "main_category"."image", "main_cate...
                                                             ^

class Category(models.Model): 
    name = models.CharField(max_length=128, unique=True)
    description = models.TextField(verbose_name=('community'))
    author = models.ForeignKey(settings.AUTH_USER_MODEL)
    image = models.ImageField(upload_to='images/', null=True, blank=True, verbose_name=('image'))
    # parent_cat = models.ForeignKey('self', null=True, blank=True)
    hotCat = models.BooleanField(default=False)
    active = models.BooleanField(default=True)

    sponsored = models.ForeignKey(Sponsored, null=True, blank=True)


    objects = CategoryManager()

    def __unicode__(self): 
        return self.name

    def get_absolute_url(self):
        return "/category/%s/" %self.name

    def get_image_url(self):
        return "%s%s" %(settings.MEDIA_URL, self.image)

0 个答案:

没有答案