中文URL:这个其实是很常识的东西,但是之前做web一直没注意过,在使用HttpResponseRedirect的时候,如果Redirect的URL中带中文的话,会报UnicodeEncodeError错误.解决的办法是使用urlquote对URL进行编码 from django.utils.http import urlquote #return的时候在URL前加上urlquote return HttpResponseRedirect(urlquote("/wiki/%s" % p
python - Django: Converting an entire set of a Model's objects into a single dictionary - Stack Overflow 167 down vote You can also rely on django code already written ;). from django.forms.models import model_to_dict model_to_dict(instance, fields=[