TypeError at /post/ render_to_response() got an unexpected keyword argument 'context_instance'
Exception Type: TypeError at /post/
Exception Value: render_to_response() got an unexpected keyword argument 'context_instance'
https://stackoverflow.com/questions/39629793/typeerror-at-post-render-to-response-got-an-unexpected-keyword-argument-con
formtools not supported the Django 1.10 version please downgrade your Django release for the workaround.
https://github.com/django/django-formtools/issues/75
I solved it by some changes in lib/python3.5/site-packages/formtools/preview.py file. Here I first changes render_to_response to render and then removed context_instance=RequestContext(request) from argument. Suppose post_post method now look like:
def post_post(self, request):
"""
Validates the POST data. If valid, calls done(). Else, redisplays form.
"""
form = self.form(request.POST, auto_id=self.get_auto_id())
if form.is_valid():
if not self._check_security_hash(
request.POST.get(self.unused_name('hash'), ''),
request, form):
return self.failed_hash(request) # Security hash failed.
return self.done(request, form.cleaned_data)
else:
return render(request, self.form_template,
self.get_context(request, form))It looks like it was already fixed in their repository:
https://github.com/django/django-formtools/blob/master/formtools/preview.py#L88
in this commit:
https://github.com/django/django-formtools/commit/46b6839fb0063fa10ffb896ce80f7155ca7a9f6e
Uninstall django-formtools (
pip uninstall django-formtools) and install the library using this this pip command instead:
pip install -e git+git://github.com/django/django-formtools#egg=django-formtools
TypeError at /post/ render_to_response() got an unexpected keyword argument 'context_instance'的更多相关文章
- TypeError: parse() got an unexpected keyword argument 'transport_encoding'
错误: TypeError: parse() got an unexpected keyword argument 'transport_encoding'You are using pip vers ...
- TypeError: __init__() got an unexpected keyword argument 't_command'
python .\manage.py migrate 报错如下 λ python .\manage.py migrateTraceback (most recent call last): File ...
- TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'
错误: TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' 参照https://blog.c ...
- TypeError: to_categorical() got an unexpected keyword argument 'nb_classes'
在学习莫烦教程中keras教程时,报错:TypeError: to_categorical() got an unexpected keyword argument 'nb_classes',代码如下 ...
- TypeError: pivot_table() got an unexpected keyword argument 'rows'
利用Python进行数据分析>第二章,处理MovieLens 1M数据集,有句代码总是报错: mean_rating = data.pivot_table('rating', rows='tit ...
- TypeError: parse() got an unexpected keyword argument 'transport_encoding' 安装tensor后报错
TypeError: parse() got an unexpected keyword argument 'transport_encoding' 巨蛋疼,出这个问题后,老夫真是醉了,mmp,最后在 ...
- Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复
网上很多写法都是 type='fanout' 这样的.(这里是基于python=3.6版本, pika=0.13.0 版本) credentials = pika.PlainCredentials(' ...
- TypeError: _obtain_input_shape() got an unexpected keyword argument 'include_top'
报错 Traceback (most recent call last): File "D:/PyCharm 5.0.3/WorkSpace/3.Keras/2.Application中五款 ...
- Django TypeError: render() got an unexpected keyword argument 'renderer'
场景: Xadmin添加plugin 来源: 1. xadmin与DjangoUeditor的安装 (第3.3章节) 2. 增加富文本编辑器Ueditor (第14.7章节) 报错: Django T ...
随机推荐
- 踩坑 Uncaught RangeError: Maximum call stack size exceeded
今天遇到了一个错误, 堆栈溢出,很好奇就是一个简单ajax请求怎么会报这个错误,研究了一下,发现犯了一个很低级的错误,data的参数错误了: passWord是未定义的变量,值为空,然后导致了这个问题 ...
- CSU-2019 Fleecing the Raffle
CSU-2019 Fleecing the Raffle Description A tremendously exciting raffle is being held, with some tre ...
- Leetcode 517.超级洗衣机
超级洗衣机 假设有 n 台超级洗衣机放在同一排上.开始的时候,每台洗衣机内可能有一定量的衣服,也可能是空的. 在每一步操作中,你可以选择任意 m (1 ≤ m ≤ n) 台洗衣机,与此同时将每台洗衣机 ...
- Eureka 简介以及简单示例(创建EurekaServer工程)
Eureka 是一款开源的服务注册与发现组件,通过配合其他组件可提供负载均衡能力. 服务发现类型的技术对比: 名称 类型 AP/CP 语言 依赖 集成 一致性算法 Eureka General AP ...
- eclipse中xml文件报错异常处理
最近一个Javaweb工程中常出现xml文件的xsd验证失败信息,异常如下: <?xml version="1.0" encoding="UTF-8"?& ...
- BZOJ4000 [TJOI2015]棋盘 【状压dp + 矩阵优化】
题目链接 BZOJ4000 题解 注意题目中的编号均从\(0\)开始= = \(m\)特别小,考虑状压 设\(f[i][s]\)为第\(i\)行为\(s\)的方案数 每个棋子能攻击的只有本行,上一行, ...
- spring+freemarker+redis
1./pom.xml文件内容: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http ...
- 人类基因(human)
题目描述 上了大学之后,小W和小Z一起报了一门三宝课,在实践课上遇到了一些问题. 一条染色体上有nn对基因,每种基因都可以用一个数ai来表示,作为标号. 现在,在其中一条染色单体上某基因发生了突变. ...
- ClassLoader 提供了两个方法用于从装载的类路径中取得资源:
转:http://cheneyph.iteye.com/blog/831721 ClassLoader 提供了两个方法用于从装载的类路径中取得资源: public URL getResource ( ...
- 回文串(bzoj 3676)
Description 考虑一个只包含小写拉丁字母的字符串s.我们定义s的一个子串t的“出 现值”为t在s中的出现次数乘以t的长度.请你求出s的所有回文子串中的最 大出现值. Input 输入只有一行 ...