我正在尝试找到解决此错误的方法:
列posts_post.slug 不存在
第 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)