python - Django:“WSGIRequest”对象没有属性“Post”
问题描述
我对 Django 有点陌生,并且已经陷入了一些简单的 POST 问题。
下面是 profile.html 中的 HTML:
<form action="{% url 'profile' %}" method="post">
{% csrf_token %}
<input type="text" placeholder="Weight", name="weight">
<input type="text" placeholder="Reps", name="reps">
<input type="submit">
</form>
这是相应的视图:
def profile(request):
if request.method == "GET":
return render(request, "userprofile/profile.html")
elif request.method == "POST":
print(request.Post)
return render(request, "userprofile/profile.html")
基本上,我现在要做的就是将 POST 数据字典打印到终端中。但是,我收到以下错误:/profile/ 'WSGIRequest' 对象的 AttributeError 没有属性 'Post'。我错过了什么?
非常感谢您的帮助!
解决方案
根据要求没有属性“发布”。但是,有 request.POST
你能request.Post
改成request.POST
推荐阅读
- cordova - 尝试在 ionic 4 项目中安装时出现@ionic/storage npm 安装错误
- c# - 更新父表时更新子表的最佳方法是什么?
- c++ - 我的模板类方法返回错误类型?
- html - 无法从 Swift 中较大的多行字符串中提取子字符串
- javascript - 获取获取内容?
- c - 理解和操作指向整数数组的指针
- c++ - 如何编写已继承的大纲构造函数?
- python - 根据字典中的键和值删除重复的字典
- python - 使用 selenium 在 python 中选择单选按钮并从中获取相应的值
- java - WSO2 API Manager 多租户环境中启用 SaaS 的应用程序中的授权服务中介