pip 升级 pip 失败

今天在使用 python pip 安装一个 python 包的时候,一直提示:

# pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages
You are using pip version 8.1.1, however version 8.1.2 is available …
more ...

Django Admin 使用 filter_horizontal 不生效

Django 1.2.7 admin在使用ManyToManyField的时候,默认使用垂直filter_vertical方式进行显示与选择。此方式在选项比较多的时候,难以直观的看出哪些选项被选中,在尝试使用filter_horizontal进行显示的时候,我们碰到了一些问题。

more ...


Django multiple select option with title

from django import forms
from django.utils.encoding import force_unicode
from django.utils.html import escape, conditional_escape

class SelectMultipleWithTitle(forms.SelectMultiple):
    """ multiple select optihon with title """
    def render_option(self, selected_choices, option_value, option_label):
        option_value = force_unicode(option_value)
        selected_html = (option_value in selected …
more ...