在做myblog项目时遇到的错误
来源:互联网 发布:got it 编辑:程序博客网 时间:2024/05/04 10:50
使用的工具:django + js
在使用模板将数据传递给js时 要记给字符串参数加引号
onclick=send_xx( {{ data | encrypt }}) #错误onclick=send_xx(" {{ data | encrypt }}") #正确
在template 中调用url
在urls.py 定义的url 可以在temp中调用,调用前需要先命名
url(r’^test/’, Test.as_view(),name=’test’),
{{url base}}
*项目报错:**Reverse for ‘’ with arguments ‘()’ and keyword arguments ‘{}’ not found
There are 3 things I can think of off the top of my head:
我的错是第三种,虽然我也不知道为啥,改了个名字就可以了
1. Just used named urls, it’s more robust and maintainable anyway
2. Try using django.core.urlresolvers.reverse at the command line for a (possibly) better error
from django.core.urlresolvers import reverse reverse('products.views.filter_by_led')
3. Check to see if you have more than one url that points to that view
PS: 后来发现原来我的extends 也修改了
原先 {% extends ‘base.html’ %} 改为 {% extends ‘./base.html’ %}后才能成功
PPPPS 忘记我的templates是改了路径,统一放在myblog/templates下的
js传数组给django:
$.ajax({
transitional:true,
data:{
data:list_
}
})
django:
request.POST.getlist(‘data’)
关于DIV无法触发onblur问题
默认情况下div 等元素是没有onblur事件的需要加上 tabindex=x 才行
关于js 计时器:
刚开始计时器只能执行一次,我就纳闷了,后来经查百度发现原来在使用计时器时需要调用自身。
function send(){ s--; alert(s) t = setTimeout('send()',1000); if(s==0){ s=60; clearTimeout(t); }
dropdown-menu 一经点击它就会消失,但是!!!
使用 event.stopPropagation();可以解决
在写正则的时候要注意,parttern字符串不一定要抱在 “/ /”中
re=new RegExp("[a-z]+\@[a-z]+\.[a-z]+");
修改用户密码:
要注意不能使用 request.user.set_password( newpass)
要使用 :
from django.contrib.auth.hasher import make_passworduser.password = make_password(newpass)
因为前者只有在密码为空时才会设置
- 在做myblog项目时遇到的错误
- 做java项目时遇到的错误
- 在做一个Servlet上传文件时遇到的错误
- 我在第一次做项目时遇到的那些事儿
- SSM做项目时遇到的问题
- 在做项目的过程中TabHost遇到的问题
- 关于flex在做项目中遇到的问题
- Django开发myblog自己一步步做的(一)
- 项目打release时遇到的错误
- 在owb11.2组件上部署执行owb_demo11.1项目时遇到的错误及其解决
- Kingbase在初始化时遇到的错误
- 在写WIN32时遇到的错误
- 项目中遇到的错误
- maven项目遇到的错误
- 做WebView的时候遇到的错误
- 自己做项目时遇到的这点事儿...
- 关于今天做项目时遇到的问题 以及解决办法
- 做项目时遇到文件的串口化问题小结
- Caffe分类accuracy过低
- 一周搞定期末考系列之《数据库原理及运用》
- 【模式识别】Fisher线性判别
- js操作cookie
- USACO-Section1.3 Prime Cryptarithm
- 在做myblog项目时遇到的错误
- android开发笔记之APK大小优化
- 创建react-native项目
- matlab(3):BP神经网络
- 数据库驱动及URL对应表
- CentOS6.7使用nginx提供静态资源服务,反向代理和负载均衡
- Spring-data JPA初次接触
- Python进阶(五十一)-Flask文件上传提示PermissionError: [Errno 13] Permission denied: 'E:\\IDEA Projects\\Data'
- codeforces——677A——Vanya and Fence