我試圖找到一個解決這個錯誤我不斷收到PostgreSQL的DatabaseError柱:和Django
列posts_post.slug不存在
LINE 1:選擇 「posts_post」, 「ID」。 ,「posts_post」,「title」,「posts_post」...
有沒有人知道可能是什麼原因造成的?
以下是完整的錯誤輸出:http://dpaste.com/813336/
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
class Category(models.Model):
name = models.CharField(max_length=60)
def __unicode__(self):
return self.name
class Tags(models.Model):
name = models.CharField(max_length=60)
def __unicode__(self):
return self.name
class Post(models.Model):
title = models.CharField(max_length=120)
slug = models.SlugField(max_length=120, unique=True)
description = models.TextField()
body = models.TextField()
published = models.DateTimeField(default=datetime.now)
categories = models.ForeignKey(Category)
tags = models.ManyToManyField(Tags)
def __unicode__(self):
return self.title
class Meta:
ordering = ['-published']
def get_absolute_url(self):
return "/%s/%s/%s" % (self.published.year, self.published.month, self.slug)
非常感謝! –