2011-05-17から1日間の記事一覧

templateのデフォルト値を変える。

デフォルトは""なので分かりにくい。settings.pyに以下を追加すると、テンプレートで間違えた時の表示が変わる。 TEMPLATE_STRING_IF_INVALID = "THIS IS NOT EXIST"

views.pyにview関数をwrapするオブジェクトを作る

以下のようなurlを指定する必要があって面倒。 json/foo json/bar json/hoo .... 普通にurls.pyを書くと from django.conf.urls.defaults import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import…

jquery.templateの使い方

jquery.pluginなので個別にいれる必要がある。 どんな表示になるかは何に貼ればよいのか分からなかったのでとりあえずjsdo.itに <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://code.jquery.com/jquery-latest.min.js"></script> </meta></head></html>

jquery.pluginの書き方(memo)

これが一番良い書き方かは分からない。 参考にしたライブラリを元にjqueryのpluginの書き方をメモ。 雛形 // jquery.foo.js (function($) { $.fn.foo = function(opts) { var options = $.extend({}, $.fn.foo.defaults, opts), action1 = function{ }, acti…