- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
<分区>
我是 django 和 python 的新手,我正在尝试从 html 页面中的复选框更新数据库 bool 字段。当我尝试访问 View 方法中的复选框时,出现此错误:“WSGIRequest”对象没有属性“Post”
这是我在 HTML 中的代码:
<body>
{% if all_crosses %}
<form action= 'lines/inventory/' method="POST">
{%csrf_token%}
<input type="submit" value="Submit" />
{% for cross in all_crosses %}
<table style="margin-bottom: 20px">
<!-- Checkbox + Name -->
<tr>
<td>
{% if cross.exists %}
<input type="checkbox" value="{{ cross.id }}" name="exist" id="exist{{ forloop.counter }}" checked >
{% else %}
<input type="checkbox" value="{{ cross.id }}" name="exist" id="exist{{ forloop.counter }}" >
{% endif %}
</td>
<td>
<li>Cross Name: {{cross.Name}}</li>
</td>
</tr>
</table>
{% endfor %}
</form>
{% endif %}
</body>
这是 View 中的代码:
def update_existence(request):
all_crosses = RaisingStatus.objects.all()
if request.method == "POST":
if ('exist' in request.POST):
print('Post')
checks = request.Post['exist']
# My desired processing here
return render(request, 'lines/inventory.html', {'all_crosses' : all_crosses})
我也试过 request.Post.getlist() 也报同样的错误
如果我像这样制作上下文处理器: def add_external(request): context = {"stext":"this is the info"} return con
我在 views.py 文件中的这个函数中遇到了这个错误。这很令人困惑,因为我不知道“WSGIRequest”是什么,也不知道它为什么给我带来问题。我知道我有一个名为“newUser”的变量,因为当我
我在发布到API时遇到了麻烦,无法完全弄清该错误指的是什么。如果重要的话,我使用的是Django REST,并包含了回溯。 if (repeat == false) { post_data =
我已经制作了一个这样的身份验证类: Token Authentication for RESTful API: should the token be periodically changed? re
我正在尝试使用 Django 创建登录表单。我正在创建一个 View 女巫将处理登录的获取和发布请求。 这是我如何设计它的: class Login(View): def get(self,r
我正在尝试在我的 django 项目中创建一个身份验证模块。但是当我打开我的网站 url 时出现此错误:'WSGIRequest' object has no attribute 'user' 我试图
我有时会在 process_response 方法中的自定义中间件中收到此错误。我有以下中间件列表: MIDDLEWARE_CLASSES = [ 'django.middleware.common.
当我在自定义中间件类的 process_view 中执行 request.set_cookie() 时,我不断收到此异常。这是我的 settings.py 中中间件类的顺序: MIDDLEWARE_C
我正在尝试向 API 发出发布请求,并将结果保存到我的数据库表之一中。 这是我的代码。 这是我的模型。 patientId 是 MyUser 表的 userId 的外键 class MyUser(Ab
我有 Django1.9 中间件类: class MyMiddleware(object): def process_request(self, request): token
我已经针对类似问题尝试过一些解决方案,但没有一个有效: 'WSGIRequest' object has no attribute 'session' 'WSGIRequest' object has
我想制作一个应用程序,它可以获取 Excel 文件并读取其内容,而不使用表单和模型。 我不断收到标题中的错误,我想知道错误是什么。 这是我的 HTML: {% csrf_token %}
我正在我的 views.py 中检查用户是否经过身份验证。然而,Django 不断抛出异常 WSGIRequest 对象没有属性“is_authenticated”。我阅读了 stackoverflo
我正在尝试使用 curl 的 put 请求向本地服务器发出 put 请求: curl -X PUT -H "Content-Type: application/json" -d '{"connid":
我明白了AttributeError("'WSGIRequest' 对象没有属性 'args'",)当我尝试调用这个电话时 GET/sign_s3/?s3_object_type=image/jpeg
有人知道怎么回事吗?我有一个 wsgi 错误。我想添加一些信息来评分,特别是日期。但是,我收到此 wsgi 错误: 错误: AttributeError at /polisy/add_payd
我正在制作一个网页。有两种看法。 索引 和详细信息。在索引中,我使用 response.set_cookie('key', key) 为用户设置 cookie,其中 response = HttpRe
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我正在尝试用 Django 制作一个非常基本的网站。现在你只需输入你的名字,它就会被保存。但即使我按照说明进行操作 here它抛出错误 'WSGIRequest' object has no attr
这个问题已经有答案了: Django - Where are the params stored on a PUT/DELETE request? (8 个回答) 已关闭 7 年前。 def my_v
我是一名优秀的程序员,十分优秀!