我正在关注此link以生成我的Django V1.7
项目文档,但它无法正常运行。例如,在下面提到的模型BlogEntry
的文档字符串中,Blog.blog
和auth.User
的链接未显示,而是显示为纯文本。
class BlogEntry(models.Model):
"""
Stores a single blog entry, related to :model:`blog.Blog` and
:model:`auth.User`.
"""
slug = models.SlugField(help_text="A short label, generally used in URLs.")
author = models.ForeignKey(User)
blog = models.ForeignKey(Blog)
...
def publish(self):
"""Makes the blog entry live on the site."""
...
但是对于下面提到的视图,除标题外,它的工作正常。
def my_view(request, slug):
"""
Display an individual :model:`myapp.MyModel`.
**Context**
``RequestContext``
``mymodel``
An instance of :model:`myapp.MyModel`.
**Template:**
:template:`myapp/my_template.html`
"""
return render_to_response('myapp/my_template.html', {
'mymodel': MyModel.objects.get(slug=slug)
}, context_instance=RequestContext(request))