class Category(models.Model):
title = models.CharField(max_length=100, db_index=True,unique=True)
slug = models.SlugField(max_length=100, unique=True)
def __unicode__(self):
return self.title
def get_absolute_url(self):
return (reverse('tags',[str(self.slug)])
class Blog(models.Model):
title = models.CharField(max_length=100, unique=True)
slug = models.SlugField(max_length=100, unique=True)
body = models.TextField()
posted = models.DateField(db_index=True, auto_now_add=True)
category = models.ManyToManyField(Category)
def __unicode__(self):
return self.title
def get_absolute_url(self):
return (reverse('posts',[str(self.slug)])
这是我的模型,我在课堂上遇到了一个愚蠢的错误:
在第 16 行第 1 列遇到“类”。期待以下之一:
“(”...“)”...“[”...“”...“。” ...“+”...
“-”...“*”...“/”...“//”...“<<”...“>>”...“% " ... "^" ... "|" ... "&" ... ">" ...
"<" ... "==" ... "<=" ... >=" ... "<>" ..." !=" ...“或”...“和”...“不是”...“是”...“在”...“如果”...“对于”...“, “……
这意味着什么?