【发布时间】:2010-06-19 21:57:17
【问题描述】:
我目前在 urls.py 中有一个条目,它为我的错误获取单独的永久链接:
from django.conf.urls.defaults import *
from tagging.views import tagged_object_list
from bugs.models import Bug
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^workarounds/', include('workarounds.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'homepage.html'}),
(r'^bugs/(?P<slug>[-\w]+)/$', 'bugs.views.bug_detail'),
(r'^bugs/tagged/(?P<tag>[^/]+)/$',
'tagging.views.tagged_object_list',
{
'queryset_or_model': Bug,
'template_name' : 'tag/lone.html'}),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)
因此,如果我指定了一个 URL,比如 bugs/tagged/firefox,它会调出 firefox 标签。我怎样才能让它被多个标签过滤掉?例如:firefox+css 将返回所有带有firefox 和css 标记的对象。
【问题讨论】:
-
你到底在问什么?如何构造url或如何构造标记查询集?
-
好吧,我猜我可以使用相同的正则表达式,除了稍作修改,但查询集部分我不确定。
标签: django django-tagging