02 2019 档案

摘要:To be a Pythonista 1. assert 例子1 如果关闭assert, 很危险 def delete_product(prod_id, user): assert user.is_admin(), 'Must be admin' assert store.has_product(p 阅读全文
posted @ 2019-02-19 12:54 Rocin 阅读(1633) 评论(0) 推荐(0)
摘要:参考 https://simpleit.rocks/python/django/generate uml class diagrams from django models/ 运用django extensions(中的graph_models) + pygraphviz(or pydotplus) 阅读全文
posted @ 2019-02-18 10:12 Rocin 阅读(1070) 评论(0) 推荐(0)
摘要:``` from functools import wraps def cache(func): cache = {} @wraps(func) def wrap( args): if args not in cache: cache[args] = func( args) return cache 阅读全文
posted @ 2019-02-11 22:21 Rocin 阅读(2054) 评论(0) 推荐(0)
摘要:参考网址 https://mathiasbynens.github.io/rel noopener/ 例子 target="_blank"会打开一个新tab,如果不加rel="noopener",那么在新tab中会有一个window.opener对象,相当于可以控制打开这个tab的前一个页面,这样会 阅读全文
posted @ 2019-02-10 17:27 Rocin 阅读(1380) 评论(0) 推荐(0)