08 2014 档案

摘要:环境:win7 64位,python 2.7.3 安装: http://twistedmatrix.com/Releases/Twisted/14.0/Twisted-14.0.0.win-amd64-py2.7.exe https://pypi.python.org/packages/2.7/z/ 阅读全文
posted @ 2014-08-28 00:29 tommy.yu 阅读(470) 评论(0) 推荐(0)
摘要:应用场景: A与B之间存在一对多关系. CBV实现方案: CreateView/UpdateView + inlineformset + jquery 具体: view方面:重写post/get方法, 或者 get_context_data/form_valid方法。 template方面:注意利用 阅读全文
posted @ 2014-08-27 22:39 tommy.yu 阅读(992) 评论(0) 推荐(0)
摘要:碰到了一个郁闷的问题,修改inlineformset时,全部删掉子表,再新增一行时,报错. 背景: 用django配合jq做动态表格,实现用js动态添加/删除行,并通过inlineformset更新到数据库.示例代码在这里:https://github.com/TommyU/dynamic_form 阅读全文
posted @ 2014-08-27 16:27 tommy.yu 阅读(1080) 评论(0) 推荐(0)
摘要:1. 属性装饰器: property cached_property 2. 对象的父类名称 对象所属的类: object.__class__ cls.__bases__ (因为父类可能不止一个,所以复数) 因此对象的父类名称为集合: [x.__name__ for x in object.__cla 阅读全文
posted @ 2014-08-27 09:43 tommy.yu 阅读(246) 评论(0) 推荐(0)
摘要:https://github.com/astrand/pyobfuscate 使用方法,调用下图文件即可,方法 python pyobfuscate.py your_code.py 即可输出在cmd里面去,复制出来替换源码即可。 阅读全文
posted @ 2014-08-22 00:22 tommy.yu 阅读(2539) 评论(0) 推荐(0)
摘要:传统方法(基于方法的视图):http://stellarchariot.com/blog/2011/02/dynamically-add-form-to-formset-using-javascript-and-django/ 概要: 服务器端,使用了formset , 文档在这里:https:// 阅读全文
posted @ 2014-08-21 21:09 tommy.yu 阅读(3836) 评论(0) 推荐(0)
摘要:raw text for ssh: git@github.com:TommyU/avbot_config.git git command on linux: git clone git://github.com/TommyU/avbot_conf.git 阅读全文
posted @ 2014-08-18 17:23 tommy.yu 阅读(145) 评论(0) 推荐(0)
摘要:查模型的列名:select column_name from information_schema.columns where table_name= 'your_table';应用:1. 给django的模型自动生成模板:select ''||replace(column_name,'_',' '... 阅读全文
posted @ 2014-08-11 17:19 tommy.yu 阅读(178) 评论(0) 推荐(0)
摘要:需求: 实现请假单的电子审批 1. 支持国际化 2. 支持模型级别的访问记录 here we go: 这里会写一系列的文章,来记录我实战的过程,由于接触django没多久,难免有疏漏之处,望拍砖不要太重。 后记 发现cnblog似乎有些鞭长莫及。因为文档编排的关系,最后用word记录了。可以这里查看 阅读全文
posted @ 2014-08-09 10:08 tommy.yu 阅读(406) 评论(0) 推荐(0)
摘要:Download for Linux and Unix It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. Debian/Ubuntu $ apt- 阅读全文
posted @ 2014-08-07 11:54 tommy.yu 阅读(247) 评论(0) 推荐(0)
摘要:child_of 此操作符,从代码来看,等价于: [('x','child_of',id)] ==> x.prarent_left >=id.parent_left && x.parent_left <= id.parent_right , 求x(的集合)。 为了形象的说明,我们一步步来: 首先,模 阅读全文
posted @ 2014-08-05 19:05 tommy.yu 阅读(1609) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2014-08-05 16:55 tommy.yu 阅读(1) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2014-08-03 14:05 tommy.yu 阅读(12) 评论(0) 推荐(0)