pip install package 時若遇到 AttributeError: _DistInfoDistribution__dep_map 時,那表示你的 pip 跟 setuptools 可能版本不合
2015-03-10
2015-03-04
Django 多國語言相關內容
Django 系統判斷多國語言的順序為
1. URL pattern(要安裝 i18n)
2. 檢查 session 裡的 LANGUAGE_SESSION_KEY (本值為 '_language' )
3. browser 的 header 的 accept-language (firefox 裡可安裝 Quick Locale Switcher)
mac os(osx) 安裝 gettext 方法
你是不是在 MAC 上安裝 GNU gettext 後依然無法正確執行?
$ django-admin.py makemessages -l "zh_TW" -settings=urproject/settings.py
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
正常安裝方式應該是
#brew install gettext
#brew link gettext --force
#django-admin.py makemessages -l "zh_TW" -settings=biyibird/settings.py
processing locale zh_TW
2014-12-26
介紹如何使用 pillow/pil 的好文章
作者有介紹各種 cut 圖的指令,但重點是他有對照的效果圖,讓你看圖就知道要選什麼效果
http://cloudinary.com/documentation/django_image_manipulation
2014-12-11
使用 jquery post data 進 django 系統
django 有 csrf 防止 cross site 攻擊,所以當你要使用 ajax post 到 django 時就會被擋。
解決方法有二:
第一是用 get, 例如:
解決方法有二:
第一是用 get, 例如:
2014-12-08
python @classmethod and @ staticmethod 的不同(筆記)
大家都知道我們可以把類別(class)裡的方法(method)設置為 static(靜態),這樣我們就可以直接使用該 method, 而不需要去產生(new)一個class出來
那麼,python是否也有同樣功能呢?
那麼,python是否也有同樣功能呢?
2014-11-28
crispy-forms 一個個field客製化表單的語法
在 crispy-forms 中,預設的uni-form, bootstrap, bootstrap3 是不是無法符合你要顯示的表單樣式呢?
你是不是想一個個欄位塞到你的 form 裡呢?
存取 crispy field 的語法就是
{% crispy_field field attr1 value1 attr2 value2 ... %}
例如在你的 template.html 裡
<form>
......
{% crispy_field form.email "placeholder" "someone@example.com" "attr1" "value1" "attr2" "value2"%}
......
......
</form>
執行結果他會顯示為
<input attr1="value1" attr2="value2" class="emailinput form-control" id="id_info-email" maxlength="75" name="info-email" placeholder="someone@example.com" type="email">
訂閱:
文章 (Atom)