SmNHmB <a href=”http://ynplfxmsfjas.com/“>ynplfxmsfjas</a>, [url=http://afzikbuhbzzy.com/]afzikbuhbzzy[/url], [link=http://rmvxarlrgmyq.com/]rmvxarlrgmyq[/link], http://lxjsvkwlvktf.com/
oMhafb <a href=”http://wxqvnkowipsh.com/“>wxqvnkowipsh</a>, [url=http://jgrcakhpncly.com/]jgrcakhpncly[/url], [link=http://rmojkmnglmff.com/]rmojkmnglmff[/link], http://npmxesmysuxb.com/
ESWfz2 <a href=”http://qhhwejzlvhdg.com/“>qhhwejzlvhdg</a>, [url=http://dgjhcvixtkbj.com/]dgjhcvixtkbj[/url], [link=http://zzqibhslmuii.com/]zzqibhslmuii[/link], http://snkoxhyeojqh.com/
2fPTAc <a href=”http://llijnkwkoyyd.com/“>llijnkwkoyyd</a>, [url=http://xxyyyrvmmlqq.com/]xxyyyrvmmlqq[/url], [link=http://dunaskbxxsll.com/]dunaskbxxsll[/link], http://olwmgfgxzaof.com/
PaYeM0 <a href=”http://dhmykebhsimg.com/“>dhmykebhsimg</a>, [url=http://hyizkgihaqdi.com/]hyizkgihaqdi[/url], [link=http://jcinmepstroe.com/]jcinmepstroe[/link], http://svbiputphxel.com/
瀹屾垚甯哥敤鐨勭畝鍗曚换鍔★細閲嶅畾鍚戝埌鍙︿竴涓〉闈互鍙婃覆鏌撲竴涓寚瀹氱殑妯℃澘銆
38fEhz <a href=”http://cajhjkeswyws.com/“>cajhjkeswyws</a>, [url=http://bcggwqooqnsq.com/]bcggwqooqnsq[/url], [link=http://ittkllncleip.com/]ittkllncleip[/link], http://zfhojpnwcklx.com/
鍛堢幇鍩轰簬鏃ユ湡鐨勬暟鎹殑骞/鏈/鏃ュ綊妗i〉闈紝鍏宠仈鐨勮鎯呴〉闈紝鏈鏂伴〉闈€侱jango Weblogs (http://www.djangoproject.com/weblog/)鐨勫勾銆佹湀銆佹棩鐨勫綊妗e氨鏄娇鐢ㄩ氱敤瑙嗗浘 鏋舵瀯鐨勶紝灏卞儚鏄吀鍨嬬殑鏂伴椈鎶ョ焊褰掓。銆
Pnx4JT <a href=”http://uokrhwbsdkgc.com/“>uokrhwbsdkgc</a>, [url=http://qbsfadvarxud.com/]qbsfadvarxud[/url], [link=http://gwdbaeqxnhlf.com/]gwdbaeqxnhlf[/link], http://nxukqcjxxtly.com/
i8AMSk <a href=”http://svhztxsiryev.com/“>svhztxsiryev</a>, [url=http://xhznnmbnuzku.com/]xhznnmbnuzku[/url], [link=http://gqqhpwyksfhs.com/]gqqhpwyksfhs[/link], http://rcpuvnqhetvh.com/
cSp6KO <a href=”http://zjtnkayajtcn.com/“>zjtnkayajtcn</a>, [url=http://skkxesnzsack.com/]skkxesnzsack[/url], [link=http://sakmtrjlashw.com/]sakmtrjlashw[/link], http://fkctfgdjzsjl.com/
EWMqsf <a href=”http://zqlypjgfuqno.com/“>zqlypjgfuqno</a>, [url=http://wlgybeuamsyg.com/]wlgybeuamsyg[/url], [link=http://pavtyxnjmwtt.com/]pavtyxnjmwtt[/link], http://rmdzoqinkave.com/
渚嬪锛屼笅闈㈡槸涓涓憟鐜伴潤鎬佲滃叧浜庘濋〉闈㈢殑URLconf锛
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template urlpatterns = patterns('', ('^about/$', direct_to_template, { 'template': 'about.html' }) )
涓鐪肩湅涓婂幓浼间箮鏈夌偣涓嶅彲鎬濊锛屼笉闇瑕佺紪鍐欎唬鐮佺殑瑙嗗浘锛佸畠鍜岀鍏珷涓殑渚嬪瓙瀹屽叏涓鏍凤細 direct_to_template 瑙嗗浘浠庡弬鏁颁腑鑾峰彇娓叉煋瑙嗗浘鎵闇鐨勭浉鍏充俊鎭
鍥犱负閫氱敤瑙嗗浘閮芥槸鏍囧噯鐨勮鍥惧嚱鏁帮紝鎴戜滑鍙互鍦ㄦ垜浠嚜宸辩殑瑙嗗浘涓噸鐢ㄥ畠銆備緥濡傦紝鎴戜滑鎵╁睍 about渚嬪瓙鎶婃槧灏勭殑URL浠 /about/<whatever>/ 鍒颁竴涓潤鎬佹覆鏌 about/<whatever>.html 銆 鎴戜滑棣栧厛淇敼URL閰嶇疆鍒版柊鐨勮鍥惧嚱鏁帮細
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template **from mysite.books.views import about_pages** urlpatterns = patterns('', ('^about/$', direct_to_template, { 'template': 'about.html' }), **('^about/(w+)/$', about_pages),** )
鎺ヤ笅鏉ワ紝鎴戜滑缂栧啓 about_pages 瑙嗗浘鐨勪唬鐮侊細
from django.http import Http404 from django.template import TemplateDoesNotExist from django.views.generic.simple import direct_to_template def about_pages(request, page): try: return direct_to_template(request, template="about/%s.html" % page) except TemplateDoesNotExist: raise Http404()
鍦ㄨ繖閲屾垜浠薄浣跨敤鍏朵粬鍑芥暟涓鏍蜂娇鐢 direct_to_template 銆傚洜涓哄畠杩斿洖涓涓 HttpResponse 瀵硅薄锛屾垜浠彧闇瑕佺畝鍗曠殑杩斿洖瀹冨氨濂戒簡銆傛湁涓涓◢寰鏉傜殑鍦版柟锛岃澶勭悊娌℃湁鎵惧埌妯℃澘鐨勬儏鍐点 鎴戜滑涓嶅笇鏈涗竴涓笉瀛樺湪鐨勬ā鏉垮紩鍙戞湇鍔″櫒閿欒锛屾墍浠ユ垜浠崟鎹 TempalteDoesNotExist 寮傚父 骞惰繑鍥404閿欒銆
杩欓噷鏈夋病鏈夊畨鍏ㄦч棶棰橈紵
鐪煎皷鐨勮鑰呭彲鑳藉凡缁忔敞鎰忓埌涓涓彲鑳界殑瀹夊叏婕忔礊锛氭垜浠洿鎺ヤ娇鐢ㄤ粠瀹㈡埛绔祻瑙堝櫒鏉ョ殑鏁版嵁鏋勯 妯℃澘鍚嶇О(template="about/%s.html" % page )銆備箥鐪嬭捣鏉ワ紝杩欏儚鏄竴涓粡鍏哥殑 鐩綍閬嶅巻锛坉irectory traversal锛 鏀诲嚮锛堣鎯呰鐪嬬鍗佷節绔狅級銆備簨瀹炵湡鏄繖鏍峰悧锛
瀹屽叏涓嶆槸銆傛槸鐨勶紝涓涓伓鎰忕殑 page 鍊煎彲浠ュ鑷寸洰褰曡法瓒婏紝浣嗘槸灏界 page 鏄 浠 璇锋眰鐨刄RL涓幏鍙栫殑锛屽苟涓嶆槸鎵鏈夌殑鍊奸兘琚帴鍙椼傝繖灏辨槸URL閰嶇疆鐨勫叧閿墍鍦細鎴戜滑浣跨敤姝e垯琛ㄨ揪寮 \w+ 鏉ヤ粠URL閲屽尮閰 page 锛岃 \w 鍙帴鍙楀瓧绗﹀拰鏁板瓧銆傚洜姝わ紝浠讳綍鎭舵剰鐨勫瓧绗 锛堜緥濡傚湪杩欓噷鏄偣 . 鍜屾鏂滅嚎 / 锛夊皢鍦║RL瑙f瀽鏃惰鎷掔粷锛屾牴鏈笉浼氫紶閫掔粰瑙嗗浘鍑芥暟銆
direct_to_template 姣棤鐤戦棶鏄潪甯告湁鐢ㄧ殑锛屼絾Django閫氱敤瑙嗗浘鏈鏈夌敤鐨勬槸鍦ㄥ憟鐜 鏁版嵁搴撲腑鐨勬暟鎹傚洜涓鸿繖涓簲鐢ㄥ疄鍦ㄥお鏅亶浜嗭紝Django甯︽湁寰堝鍐呭缓鐨勯氱敤瑙嗗浘鏉ュ府鍔╀綘寰堝鏄 鐨勭敓鎴愬璞$殑鍒楄〃鍜屾槑缁嗚鍥俱
璁╂垜浠厛鐪嬬湅鍏朵腑鐨勪竴涓氱敤瑙嗗浘锛氬璞″垪琛ㄨ鍥俱傛垜浠娇鐢ㄧ浜旂珷涓殑 Publisher 鏉ヤ妇渚嬶細
class Publisher(models.Model): name = models.CharField(maxlength=30) address = models.CharField(maxlength=50) city = models.CharField(maxlength=60) state_province = models.CharField(maxlength=30) country = models.CharField(maxlength=50) website = models.URLField() def __str__(self): return self.name class Meta: ordering = ["-name"] class Admin: pass
瑕佷负鎵鏈夌殑涔︾睄鍒涘缓涓涓垪琛ㄩ〉闈紝鎴戜滑浣跨敤涓嬮潰鐨刄RL閰嶇疆锛
from django.conf.urls.defaults import * from django.views.generic import list_detail from mysite.books.models import Publisher publisher_info = { "queryset" : Publisher.objects.all(), } urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info) )
杩欏氨鏄墍瑕佺紪鍐欑殑鎵鏈塒ython浠g爜銆傚綋鐒讹紝鎴戜滑杩橀渶瑕佺紪鍐欎竴涓ā鏉裤傛垜浠彲浠ラ氳繃鍦ㄩ澶栧弬鏁 瀛楀吀閲屽寘鍚 template_name 鏉ユ竻妤氱殑鍛婅瘔 object_list 瑙嗗浘浣跨敤鍝釜妯℃澘锛屼絾鏄 鐢变簬Django鍦ㄤ笉缁欏畾妯℃澘鐨勬椂鍊欎細鐢ㄥ璞$殑鍚嶇О鎺ㄥ鍑轰竴涓傚湪杩欎釜渚嬪瓙涓紝杩欎釜鎺ㄥ鍑虹殑妯℃澘鍚嶇О 灏嗘槸 "books/publisher_list.html" 锛屽叾涓璪ooks閮ㄥ垎鏄畾涔夎繖涓ā鍨嬬殑app鐨勫悕绉帮紝 publisher閮ㄥ垎鏄繖涓ā鍨嬪悕绉扮殑灏忓啓銆
杩欎釜妯℃澘灏嗘寜鐓 context 涓寘鍚殑鍙橀噺 object_list 鏉ユ覆鏌擄紝杩欎釜鍙橀噺鍖呭惈鎵鏈夌殑涔︾睄瀵硅薄銆 涓涓潪甯哥畝鍗曠殑妯℃澘鐪嬭捣鏉ヨ薄涓嬮潰杩欐牱锛
{% extends "base.html" %} {% block content %} <h2>Publishers</h2> <ul> {% for publisher in object_list %} <li>{{ publisher.name }}</li> {% endfor %} </ul> {% endblock %}
杩欏氨鏄墍鏈夎鍋氱殑浜嬨傝浣跨敤閫氱敤瑙嗗浘閰烽叿鐨勭壒鎬у彧闇瑕佷慨鏀瑰弬鏁板瓧鍏稿苟浼犻掔粰閫氱敤瑙嗗浘鍑芥暟銆 闄勫綍D鏄氱敤瑙嗗浘鐨勫畬鍏ㄥ弬鑰冭祫鏂欙紱鏈珷鎺ヤ笅鏉ョ殑绔犺妭灏嗚鍒拌嚜瀹氫箟鍜屾墿灞曢氱敤瑙嗗浘鐨勪竴浜涙柟娉曘
姣棤鐤戦棶锛屼娇鐢ㄩ氱敤瑙嗗浘鍙互鍏呭垎鍔犲揩寮鍙戦熷害銆傜劧鑰岋紝鍦ㄥ鏁扮殑宸ョ▼涓紝涔熶細鍑虹幇閫氱敤瑙嗗浘涓嶈兘 婊¤冻闇姹傜殑鎯呭喌銆傚疄闄呬笂锛屽垰鎺ヨЕDjango鐨勫紑鍙戣呮渶甯歌鐨勯棶棰樺氨鏄庢牱浣跨敤閫氱敤瑙嗗浘鏉ュ鐞嗘洿澶氱殑鎯呭喌銆
DNJEsI <a href=”http://xjeubrblziif.com/“>xjeubrblziif</a>, [url=http://dobvanweoamc.com/]dobvanweoamc[/url], [link=http://djyiudlubona.com/]djyiudlubona[/link], http://lixowftpfyrv.com/
GopzWR <a href=”http://wyzfvmcuticl.com/“>wyzfvmcuticl</a>, [url=http://jxzqmqdmwetz.com/]jxzqmqdmwetz[/url], [link=http://piilbiaihfax.com/]piilbiaihfax[/link], http://htyxquhhvexk.com/
8Vyjss <a href=”http://rhhhrvhkabeq.com/“>rhhhrvhkabeq</a>, [url=http://ahvmqfezgjmk.com/]ahvmqfezgjmk[/url], [link=http://smovmqdvshdx.com/]smovmqdvshdx[/link], http://vibqzvjswygw.com/
publisher_info = { "queryset" : Publisher.objects.all(), **"template_object_name" : "publisher",** } urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info) )
浣跨敤鏈夌敤鐨 template_object_name 鎬绘槸涓ソ鎯虫硶銆備綘鐨勮璁℃ā鏉跨殑鍚堜綔浼欎即浼氭劅璋綘鐨勩
浣犲父甯搁渶瑕佸憟鐜版瘮閫氱敤瑙嗗浘鎻愪緵鐨勬洿澶氱殑棰濆淇℃伅銆備緥濡傦紝鑰冭檻涓涓嬪湪姣忎釜鍑虹増鍟嗛〉闈㈠疄鐜版墍鏈夊叾浠 鍑虹増鍟嗗垪琛ㄣ object_detail 閫氱敤瑙嗗浘鎻愪緵浜嗗嚭鐗堝晢鍒癱ontext锛屼絾鏄湅璧锋潵娌℃湁鍔炴硶鍦ㄦā鏉夸腑 鑾峰彇 鎵鏈 鍑虹増鍟嗗垪琛ㄣ
杩欐槸瑙e喅鏂规硶锛氭墍鏈夌殑閫氱敤瑙嗗浘閮芥湁涓涓澶栫殑鍙夊弬鏁 extra_context 銆傝繖涓弬鏁版槸涓涓瓧鍏告暟鎹被鍨嬶紝鍖呭惈瑕佹坊鍔犲埌妯℃澘鐨刢ontext涓殑棰濆鐨勫璞°傛墍浠ヨ鎻愪緵鎵鏈夌殑鍑虹増鍟嗘槑缁嗙粰瑙嗗浘锛屾垜浠氨鐢ㄨ繖鏍风殑info瀛楀吀锛
publisher_info = { "queryset" : Publisher.objects.all(), "template_object_name" : "publisher", **"extra_context" : {"book_list" : Book.objects.all()}** }
杩欐牱灏辨妸涓涓 {{ book_list }} 鍙橀噺鏀惧埌妯℃澘鐨刢ontext涓傝繖涓柟娉曞彲浠ョ敤鏉ヤ紶閫掍换鎰忔暟鎹 鍒伴氱敤瑙嗗浘妯℃澘涓幓锛岄潪甯告柟渚裤
11BuSm <a href=”http://eqbfztxatswg.com/“>eqbfztxatswg</a>, [url=http://cqyvbzdkmltn.com/]cqyvbzdkmltn[/url], [link=http://crybwpchprla.com/]crybwpchprla[/link], http://zsruvjbcerqm.com/
鎴戜滑鐜板湪鏉ョ湅涓涓嬶紝 extra_context 閲屽寘鍚暟鎹簱鏌ヨ鐨勯棶棰樸傚洜涓哄湪杩欎釜渚嬪瓙涓紝鎴戜滑鎶 Publisher.objects.all() 鏀惧湪URLconf涓紝瀹冨彧浼氭墽琛屼竴娆★紙褰揢RLconf绗竴娆″姞杞界殑鏃跺欙級銆傚綋浣犳坊鍔犳垨鍒犻櫎鍑虹増鍟嗭紝浣犱細鍙戠幇鍦ㄩ噸鍚疻eb鏈嶅姟鍣ㄤ箣鍓嶏紝閫氱敤瑙嗗浘涓嶄細鍙嶆槧鍑鸿繖浜涗慨鏀圭殑锛堟湁鍏砆uerySet浣曟椂琚紦瀛樺拰璧嬪肩殑鏇村淇℃伅璇峰弬鑰冮檮褰旵涓滅紦瀛樹笌鏌ヨ闆嗏濅竴鑺傦級銆
澶囨敞
PHysZ7 <a href=”http://jbnqwfshbxue.com/“>jbnqwfshbxue</a>, [url=http://igfjyorkpypm.com/]igfjyorkpypm[/url], [link=http://wkdyrkxwmdfo.com/]wkdyrkxwmdfo[/link], http://wjhpynkhkixt.com/
瑙e喅杩欎釜闂鐨勫姙娉曟槸鍦 extra_context 涓敤涓涓洖璋冿紙callback锛夋潵 浠f浛浣跨敤涓涓彉閲忋備换浣曞彲浠ヨ皟鐢ㄧ殑瀵硅薄锛堜緥濡備竴涓嚱鏁帮級鍦ㄤ紶閫掔粰 extra_context 鍚庨兘浼氬湪姣忔瑙嗗浘娓叉煋鍓嶆墽琛岋紙鑰屼笉鏄彧鎵ц涓娆★級銆 浣犲彲浠ヨ薄杩欐牱瀹氫箟涓涓嚱鏁帮細
def get_books(): return Book.objects.all() publisher_info = { "queryset" : Publisher.objects.all(), "template_object_name" : "publisher", "extra_context" : **{"book_list" : get_books}** }
O2zMLs <a href=”http://imijpqyscyzu.com/“>imijpqyscyzu</a>, [url=http://isrvqdjbewfq.com/]isrvqdjbewfq[/url], [link=http://tiwdtcivjwov.com/]tiwdtcivjwov[/link], http://wlgvlcjtvply.com/
publisher_info = { "queryset" : Publisher.objects.all(), "template_object_name" : "publisher", "extra_context" : **{"book_list" : Book.objects.all}** }
np4DMd <a href=”http://hbsnjcfoizvz.com/“>hbsnjcfoizvz</a>, [url=http://wdikbtkrqjrv.com/]wdikbtkrqjrv[/url], [link=http://hrfbyhalrzta.com/]hrfbyhalrzta[/link], http://joxjwznpivhb.com/
8LlhZj <a href=”http://wzekxqnfpltm.com/“>wzekxqnfpltm</a>, [url=http://nfqbyffbfkil.com/]nfqbyffbfkil[/url], [link=http://byygkbksdadj.com/]byygkbksdadj[/link], http://xbrpupjsjpvs.com/
鐜板湪璁╂垜浠潵浠旂粏鐪嬬湅杩欎釜 queryset 銆傚ぇ澶氭暟閫氱敤瑙嗗浘鏈変竴涓 queryset 鍙傛暟锛岃繖涓弬鏁板憡璇夎鍥捐鏄剧ず瀵硅薄鐨勯泦鍚 锛堟湁鍏砆uerySet鐨勮В閲婅鐪嬬浜旂珷鐨 鈥滈夋嫨瀵硅薄鈥濈珷鑺傦紝璇︾粏璧勬枡璇峰弬鐪嬮檮褰旵锛夈
bQLEb6 <a href=”http://smcfsnorksba.com/“>smcfsnorksba</a>, [url=http://aruhrbpgpnzq.com/]aruhrbpgpnzq[/url], [link=http://poapiucigzvo.com/]poapiucigzvo[/link], http://yqctgzvjhqfl.com/
book_info = { "queryset" : Book.objects.all().order_by("-publication_date"), } urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info), **(r'^books/$', list_detail.object_list, book_info),** )
杩欐槸涓涓浉褰撶畝鍗曠殑渚嬪瓙锛屼絾鏄緢璇存槑闂銆傚綋鐒讹紝浣犻氬父杩樻兂鍋氭瘮閲嶆柊鎺掑簭鏇村鐨勪簨銆 濡傛灉浣犳兂瑕佸憟鐜版煇涓壒瀹氬嚭鐗堝晢鍑虹増鐨勬墍鏈変功绫嶅垪琛紝浣犲彲浠ヤ娇鐢ㄥ悓鏍风殑鎶鏈細
**apress_books = {** **"queryset": Book.objects.filter(publisher__name="Apress Publishing"),** **"template_name" : "books/apress_list.html"** **}** urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info), **(r'^books/apress/$', list_detail.object_list, apress_books),** )
娉ㄦ剰 鍦ㄤ娇鐢ㄤ竴涓繃婊ょ殑 queryset 鐨勫悓鏃讹紝鎴戜滑杩樹娇鐢ㄤ竴涓嚜瀹氫箟鐨勬ā鏉垮悕绉般 濡傛灉鎴戜滑涓嶈繖涔堝仛锛岄氱敤瑙嗗浘灏变細鐢ㄤ互鍓嶇殑妯℃澘锛岃繖鍙兘涓嶆槸鎴戜滑鎯宠鐨勭粨鏋溿
MM4VfH <a href=”http://xkukcvuspnqq.com/“>xkukcvuspnqq</a>, [url=http://hajkdanceogm.com/]hajkdanceogm[/url], [link=http://rqjewsqkkmjt.com/]rqjewsqkkmjt[/link], http://uhfoivgnfeiu.com/
澶囨敞
濡傛灉浣犲湪璇锋眰 /books/apress/ 鏃跺嚭鐜404閿欒锛岃妫鏌ヤ互纭繚浣犵殑鏁版嵁搴撲腑鍑虹増鍟 涓湁鍚嶄负Apress Publishing鐨勮褰曘傞氱敤瑙嗗浘鏈変竴涓 allow_empty 鍙傛暟鍙互 鐢ㄦ潵澶勭悊杩欎釜鎯呭喌锛岃鎯呰鐪嬮檮褰旸銆
yKnZxQ <a href=”http://bpzdrpbbjsjf.com/“>bpzdrpbbjsjf</a>, [url=http://cmholoypoxsv.com/]cmholoypoxsv[/url], [link=http://ihoiztkugwlg.com/]ihoiztkugwlg[/link], http://ozigifixmcgl.com/
urlpatterns = patterns('', (r'^publishers/$', list_detail.object_list, publisher_info), **(r'^books/(w+)/$', books_by_publisher),** )
鎺ヤ笅鏉ワ紝鎴戜滑鍐 books_by_publisher 杩欎釜瑙嗗浘锛氾紙涓婇潰鐨勪唬鐮佷腑姝e垯琛ㄨ揪寮忔湁璇紝鍦 w 鍓嶈鍔犲弽鏂滅窔锛
from django.http import Http404 from django.views.generic import list_detail from mysite.books.models import Book, Publisher def books_by_publisher(request, name): # Look up the publisher (and raise a 404 if it can't be found). try: publisher = Publisher.objects.get(name__iexact=name) except Publisher.DoesNotExist: raise Http404 # Use the object_list view for the heavy lifting. return list_detail.object_list( request, queryset = Book.objects.filter(publisher=publisher), template_name = "books/books_by_publisher.html", template_object_name = "books", extra_context = {"publisher" : publisher} )
杩欐槸鍥犱负閫氱敤瑙嗗浘灏辨槸Python鍑芥暟銆傚拰鍏朵粬鐨勮鍥惧嚱鏁颁竴鏍凤紝閫氱敤瑙嗗浘涔熸槸鎺ュ彈涓浜 鍙傛暟骞惰繑鍥 HttpResponse 瀵硅薄銆傚洜姝わ紝閫氳繃鍖呰閫氱敤瑙嗗浘鍑芥暟鍙互鍋氭洿澶氱殑浜嬨
娉ㄦ剰
XGFs79 <a href=”http://orvtfnnzdtpg.com/“>orvtfnnzdtpg</a>, [url=http://bowbdcdfhptd.com/]bowbdcdfhptd[/url], [link=http://jjgdzbrfozjj.com/]jjgdzbrfozjj[/link], http://gnqujsbgtowe.com/
鎴戜滑鍐嶆潵鐪嬬湅鏈鍚庝竴涓父鐢ㄦā寮忥細鍦ㄨ皟鐢ㄩ氱敤瑙嗗浘鍓嶅悗鍋氫簺棰濆宸ヤ綔銆
鎯宠薄涓涓嬫垜浠湪 Author 瀵硅薄閲屾湁涓涓 last_accessed 瀛楁锛屾垜浠敤杩欎釜瀛楁鏉ユ洿姝eauthor鐨勬渶杩戣闂椂闂淬傚綋鐒堕氱敤瑙嗗浘 object_detail 骞朵笉鑳藉鐞 杩欎釜闂锛屾垜浠彲浠ュ緢瀹规槗鐨勫啓涓涓嚜瀹氫箟鐨勮鍥炬潵鏇存柊杩欎釜瀛楁銆
棣栧厛锛屾垜浠渶瑕佸湪URL閰嶇疆閲岃缃寚鍚戝埌鏂扮殑鑷畾涔夎鍥撅細
from mysite.books.views import author_detail urlpatterns = patterns('', #... **(r'^authors/(?P<author_id>d+)/$', author_detail),** )
鎺ヤ笅鏉ュ啓鍖呰鍑芥暟锛
import datetime from mysite.books.models import Author from django.views.generic import list_detail from django.shortcuts import get_object_or_404 def author_detail(request, author_id): # Look up the Author (and raise a 404 if she's not found) author = get_object_or_404(Author, pk=author_id) # Record the last accessed date author.last_accessed = datetime.datetime.now() author.save() # Show the detail page return list_detail.object_detail( request, queryset = Author.objects.all(), object_id = author_id, )
娉ㄦ剰
闄ら潪浣犳坊鍔 last_accessed 瀛楁鍒颁綘鐨 Author 妯″瀷骞跺垱寤 books/author_detail.html 妯℃澘锛屽惁鍒欒繖娈典唬鐮佷笉鑳界湡姝e伐浣溿
鎴戜滑鍙互鐢ㄥ悓鏍风殑鏂规硶淇敼閫氱敤瑙嗗浘鐨勮繑鍥炲笺傚鏋滄垜浠兂瑕佹彁渚涗竴涓緵涓嬭浇鐢ㄧ殑 绾枃鏈増鏈殑author鍒楄〃锛屾垜浠彲浠ョ敤涓嬮潰杩欎釜瑙嗗浘锛
def author_list_plaintext(request): response = list_detail.object_list( request, queryset = Author.objects.all(), mimetype = "text/plain", template_name = "books/author_list.txt" ) response["Content-Disposition"] = "attachment; filename=authors.txt" return response
杩欎釜鏂规硶涔嬫墍浠ュ伐浣滄槸鍥犱负閫氱敤瑙嗗浘杩斿洖鐨 HttpResponse 瀵硅薄鍙互璞′竴涓瓧鍏 涓鏍风殑璁剧疆HTTP鐨勫ご閮ㄣ傞殢渚胯涓涓嬶紝杩欎釜 Content-Disposition 鐨勫惈涔夋槸 鍛婅瘔娴忚鍣ㄤ笅杞藉苟淇濆瓨杩欎釜椤甸潰锛岃屼笉鏄湪娴忚鍣ㄤ腑鏄剧ず瀹冦
鍦ㄨ繖涓绔犳垜浠彧璁蹭簡Django甯︾殑閫氱敤瑙嗗浘鍏朵腑涓閮ㄥ垎锛屼笉杩囪繖浜涙柟娉曚篃閫傜敤浜庡叾浠栫殑 閫氱敤瑙嗗浘銆傛湁鍏虫洿璇︾粏鐨勫唴瀹癸紝璇风湅闄勫綍D銆
鍦ㄤ笅涓绔犱腑鎴戜滑灏嗘繁鍏ュ埌Django妯℃澘绯荤粺鐨勫唴閮ㄥ幓锛屽睍绀烘墍鏈夋墿灞曞畠鐨勯叿鏂规硶銆傜洰鍓 涓烘锛屾垜浠繕鍙槸鎶婃ā鏉垮紩鎿庡綋浣滀竴涓覆鏌撳唴瀹圭殑闈欐佸伐鍏枫
鍏充簬鏈瘎娉ㄧ郴缁
鏈珯浣跨敤涓婁笅鏂囧叧鑱旂殑璇勬敞绯荤粺鏉ユ敹闆嗗弽棣堜俊鎭備笉鍚屼簬涓鑸鏁寸珷鍋氳瘎娉ㄧ殑鍋氭硶锛 鎴戜滑鍏佽浣犲姣忎竴涓嫭绔嬬殑鈥滄枃鏈潡鈥濆仛璇勬敞銆備竴涓滄枃鏈潡鈥濈湅璧锋潵鏄繖鏍风殑锛
涓涓滄枃鏈潡鈥濇槸涓涓钀斤紝涓涓垪琛ㄩ」锛屼竴娈典唬鐮侊紝鎴栬呭叾浠栦竴灏忔鍐呭銆 浣犻変腑瀹冧細楂樹寒搴︽樉绀:
瑕佸鏂囨湰鍧楀仛璇勬敞锛屼綘鍙渶瑕佺偣鍑诲畠鏃佽竟鐨勬爣璇嗗潡:
鎴戜滑浼氫粩缁嗛槄璇绘瘡涓瘎璁猴紝濡傛灉鍙兘鐨勮瘽鎴戜滑涔熶細鎶婅瘎娉ㄨ冭檻鍒版湭鏉ョ殑鐗堟湰涓幓:
濡傛灉浣犳効鎰忎綘鐨勮瘎娉ㄨ閲囩敤锛岃纭繚鐣欎笅浣犵殑鍏ㄥ悕 (娉ㄦ剰涓嶆槸鏄电О鎴栫畝绉帮級
Many, many thanks to Jack Slocum; the inspiration and much of the code for the comment system comes from Jack's blog, and this site couldn't have been built without his wonderful
YAHOO.ext
library. Thanks also to Yahoo for YUI itself.