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 ...
随机推荐
- C# 引用访问权限
同样代码表现的不同行为 创建基类(Super)和派生类(Sub)每个类有一个字段field和一个公共方法getField,并且使用内联的方式初始化为1,方法getField返回字段field.C#和J ...
- 9.Iptables与Firewalld防火墙
第9章 Iptables与Firewalld防火墙 章节简述: 保障数据的安全性是继保障数据的可用性之后最为重要的一项工作.防火墙作为公网与内网之间的保护屏障,在保障数据的安全性方面起着至关重要的作用 ...
- junit4 assert类中的assert方法总结
junit中的assert方法全部放在Assert类中,总结一下junit类中assert方法的分类. 1.assertTrue/False([String message,]boolean cond ...
- Leetcode 567.字符串的排列
字符串的排列 给定两个字符串 s1 和 s2,写一个函数来判断 s2 是否包含 s1 的排列. 换句话说,第一个字符串的排列之一是第二个字符串的子串. 示例1: 输入: s1 = "ab&q ...
- Mysql 死锁
http://www.cnblogs.com/benshan/archive/2013/05/09/3068886.html 声明:以下讨论只是针对InnoDB存储引擎. 何为死锁? 死锁是对资源 ...
- ZOJ 2676 Network Wars(最优比例最小割)
Network Wars Time Limit: 5 Seconds Memory Limit: 32768 KB Special Judge Network of Bytelan ...
- BZOJ-1043 [HAOI2008]下落的圆盘
几何题... 先把所有圆储存起来,然后对于每个圆我们求得之后放下的圆挡住了的部分,求个并集,并把没被挡到的周长加进答案. #include <cstdlib> #include <c ...
- BZOJ 4460 [Jsoi2013]广告计划 ——Bitset 后缀自动机
发现n比较小,直接枚举答案,然后发现连续的一段是确定的,然后我们只需要判断每个位置是否有这个连续的一段就好了 发现起点不同,最后的位置可能会有差距,所以DP一下就好了 然后用0表示未折返,1表示从最下 ...
- MySql数据类型和Java数据类型对应一览
类型名称 显示长度 数据库类型 JAVA类型 JDBC类型索引(int) 描述 VARCHAR L+N VARCHAR java.lang.String 12 CHAR N ...
- response contentType
response.setContentType(MIME)的作用是使客户端浏览器,区分不同种类的数据,并根据不同的MIME调用浏览器内不同的程序嵌入模块来处理相应的数据. 例如web浏览器就是通过MI ...