PostgreSQL:关系“photos_photo”的列“特色”不存在

时间:2015-06-26 19:54:49

标签: python django postgresql django-models

我正在使用Postgres与Django,但当我尝试上传照片时,我收到以下错误:column "featured" of relation "photos_photo" does not exist。但是,该领域实际上是在我的模型中,并且已经正确地进行了迁移。

当我进入dbshel​​l时,不会显示该列。此外,privatelikers也不存在。任何想法如何解决这个问题?

提前谢谢!

models.py:

class Photo(models.Model):
    active = models.BooleanField(default=True)
    category = models.ForeignKey("Category", default=1, null=False, blank=False)
    creator = models.ForeignKey(settings.AUTH_USER_MODEL, null=False)
    description = models.TextField(max_length=120, null=True, blank=True)
    featured = models.BooleanField(default=False)
    likers = models.ManyToManyField(settings.AUTH_USER_MODEL, related_name='Likers', blank=True)
    photo = models.ImageField(upload_to='user/photos/', null=False, blank=False)
    private = models.BooleanField(default=False)
    slug = models.SlugField(null=False, blank=False)
    timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)

postgres表:

Column    |           Type           |                         Modifiers                         | Storage  | Stats target | Description 
-------------+--------------------------+-----------------------------------------------------------+----------+--------------+-------------
 id          | integer                  | not null default nextval('photos_photo_id_seq'::regclass) | plain    |              | 
 title       | character varying(30)    |                                                           | extended |              | 
 description | text                     |                                                           | extended |              | 
 image       | character varying(100)   |                                                           | extended |              | 
 slug        | character varying(50)    | not null                                                  | extended |              | 
 active      | boolean                  | not null                                                  | plain    |              | 
 timestamp   | timestamp with time zone | not null                                                  | plain    |              | 
 category_id | integer                  |                                                           | plain    |              | 
 creator_id  | integer                  | not null                              

0 个答案:

没有答案