uranusjr / django-tutorial-for-programmers

Chapter text and example code for the Django tutorial first appeared during ITHome Ironman 7
289 stars 93 forks source link

讓 Django 1.8 能正常使用 Django-crispy-forms #15

Closed ccwang002 closed 9 years ago

ccwang002 commented 9 years ago

因為 django.utils.functional.memoize 在 1.8+ 被移除了,所以 crispy forms 不能正常工作。詳細見 maraujop/django-crispy-forms#345 與 maraujop/django-crispy-forms#364。

加入這兩個 PR 之後至少 Note 14 的操作都能完成。我把上述的流程整理成底下的指令:

git clone git@github.com:maraujop/django-crispy-forms.git
cd django-crispy-forms
git pull origin pull/345/head
git pull origin pull/364/head  # will prompt for merge message

# inside the target virtualenv
python setup.py install

不過不知道在 note 裡要怎麼描述這些事情,就看 TP 怎麼做了。

uranusjr commented 9 years ago

我怎麼記得 memoize 是 1.9 才會移除,1.8 只會噴 deprecation warning… 我先 check 一下好了。

uranusjr commented 9 years ago

對呀 memoize 明明就還在,怪了。我過幾天從頭再做一次好了,順便更新 project template 和 urlpatterns

ccwang002 commented 9 years ago

可以…對不起我錯了,重裝了一次 crispy-forms 1.4.0 沒有問題,應該是我 venv 設錯才會有 error

Users/liang/.virtualenvs/django/lib/python3.4/site-packages/crispy_forms/utils.py:25: RemovedInDjango19Warning: memoize wrapper is deprecated and will be removed in Django 1.9. Use django.utils.lru_cache instead.
  default_field_template = memoize(default_field_template, {}, 1)