摘要: 经常玩google+,对于前端不太内行的我来说也感觉很好奇,google+是怎么做到局部刷新的?在网上一查,无意见看到有人说google 是使用html5 的一个API :pushState() 技术来实现的。 话不多说,直接上代码 : 如果不知道具体作用是什么,就试着把红色那一行注... 阅读全文
posted @ 2012-11-21 14:17 notewo 阅读(2092) 评论(0) 推荐(0) 编辑
摘要: 方法一:修改kindeditor.js 文件 django 在整合任何的在线编辑器的时候,上传图片通常都会遇到一个csrf 验证失败的错误。 我以前的解决方法是,但是那始终是不安全的。还好找到了新的解决方法 ,伟大的 stackoverflow 以kindeditor 为例,找到主 js文件 ,如:... 阅读全文
posted @ 2012-11-17 10:31 notewo 阅读(2327) 评论(1) 推荐(0) 编辑
摘要: 参考这篇文章。http://blog.csdn.net/huyoo/article/details/6913973 我的环境是django 1.3 1 Django settings.py STATICFILES_DIRS = ( ("css", os.path.join(PROJECT_... 阅读全文
posted @ 2012-11-15 16:09 notewo 阅读(628) 评论(0) 推荐(0) 编辑
摘要: 在提交评论的时候不想刷新页面,这个时候就需要用到ajax来提交数据 。我使用的方法如下: 看上去很简单,不过有大作用。 阅读全文
posted @ 2012-11-15 14:34 notewo 阅读(1105) 评论(0) 推荐(0) 编辑
摘要: django 自带了一个分页的功能 ,使用起来很方便 。下面是使用方法 : views.pydef index(request): context = {} article = Article.objects.all() page = request.GET.get('pa... 阅读全文
posted @ 2012-11-15 10:17 notewo 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 其实这里也还是要写django form 的验证,只是有一个应用场景。 这几天老大要我开始搞一个新项目 ~~ >.<! django停了很长一段时间,一下子就忘了好多。 做一个article 的app class Article(models.Model): author = models... 阅读全文
posted @ 2012-11-14 17:22 notewo 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 有些东西使用不熟悉的话总会忘记怎么使用的 。所以还在博客上记录下来比较好。 1 \安装south :方法见官网 2、在settings.py 加入 south APP。 3、python manage.py schemamigration account --initial (account 是ap... 阅读全文
posted @ 2012-11-13 15:19 notewo 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 系统环境 :ubuntu 第一步:创建目录 : ubuntu@yee:~/notewo/locale/zh_CN/LC_MESSAGES 第二步:生成po文件 : ubuntu@yee:~/notewo$ xgettext L python -k=_ -o notewo.po $(fin... 阅读全文
posted @ 2012-11-10 15:15 notewo 阅读(701) 评论(1) 推荐(0) 编辑
摘要: 第一:安装 sudo easy_install SQLAlchemy 第二:基本的使用:1 先写个脚本 尝试连接mysql ,创建一张表: # -*- coding: UTF-8 -*-from sqlalchemy import *import sqlalchemy.util as util... 阅读全文
posted @ 2012-11-08 10:47 notewo 阅读(527) 评论(0) 推荐(0) 编辑
摘要: $("#id_country option[value='{{ item.country }}']").attr("selected",true) 就简单一句。记录下来 阅读全文
posted @ 2012-09-05 14:16 notewo 阅读(569) 评论(0) 推荐(0) 编辑