【发布时间】:2018-12-11 00:00:10
【问题描述】:
我正在尝试学习 Django,我在书中发现了以下代码。
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=????????????)
author = models.ForeignKey(
'auth.User',
on_delete=models.CASCADE,
)
body = models.TextField()
def __str__(self):
return self.title
尽管我了解其中的大部分内容,但我并不真正了解 "auth.User" 在代码中的作用。此外,我尝试在文档中搜索它,但没有成功(我觉得很奇怪)。
非常感谢您的帮助。
【问题讨论】:
标签: python django authentication