Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
尝试在 Django 中查看,将 UserProfile 挂接到我的用户配置文件模块中。我想做类似的事情:
@login_required def viewfunction (request): if request.user.get_profile(): << do something here >>
但是这样做会出错。是否有测试用户配置文件模块存在的最佳实践?
您可以确保您的 UserProfile 是通过信号创建的。这是一个相关的问题。