2007年05月28日 星期一 21:59
»ÆÒã дµÀ:
>
> Ò»¿ªÊ¼ÊÇÓÃÁËgeneric views (archive_month object_list),µ«ÊÇÒª×öһЩ
> Ð޸ģ¨ÒòΪÎÒÕâ¸öÊǶàÈËblog£¬ÐèҪѡÔñ²»Í¬µÄqueryset)£¬ËùÒÔÎÒÖ±½ÓÓÃ
> ·´¶ø¸üÁé»îЩ¡£
>
> дһ¸öͨÓÃµÄ wrapper »¹ÊǺܷ½±ãµÄ¡£
>
Çë½ÌÕâ¸öwrapper¸ÃÔõôд£¿
ÎÒµ±Ê±ÊÇÐÞ¸ÄÁËgeneric viewµÄʵÏÖ£¬±ÈÈçobject_list£¬ËüÖ»½ÓÊÜqueryset,ÎÒÏë
´«Blog.object.filter(name=blog)
info_dict = {
'model': Blog,
'date_field': 'pub_date',
}
urlpatterns = patterns('django.views.generic.date_based',
(r'^/(?P\w{1,30})/(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')),
ÎÒÏ£Íû ¸ù¾ÝnameÀ´filter
)
лл£¡:)
> --
> http://codeplayer.blogspot.com/
>
> --~--~---------~--~----~------------~-------~--~----~
> '''ÓʼþÀ´×ÔGroups "python-cn"--China Py User Group
> ÏêÇé: http://groups-beta.google.com/group/python-cn
> ·¢ÑÔ: python-cn在googlegroups.com
> Í˶©: python-cn-unsubscribe在googlegroups.com
> ά»ù: http://wiki.woodpecker.org.cn/moin/CPUG
> ͬÀàÁбí: http://python.cn/mailman/listinfo/python-chinese
> ÉçÇøÊÂÎñ: http://groups.google.com/group/CPUG
> ±±¾©ÊÂÎñ: http://groups.google.com/group/bpug
> ¶«ÄÏÊÂÎñ: http://groups.google.com/group/cpug-eastchina
> '''
> -~----------~----~----~----~------~----~------~--~---
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070528/079ae305/attachment.html
Zeuux © 2025
京ICP备05028076号