这似乎是一个经典的"问题:
> / tr / showroom /的NoReverseMatch 反向'项目列表'参数'()'和关键字参数' {}'未找到。尝试了0种模式:[]
但问题是,当我检查互联网上的不同主题,然后查看我的文件时,我无法获得它。
因此,它完全适用于母语。当我尝试仅在此展厅页面上更改语言时,就会发生这种情况。 使用commad cms副本复制的每个页面都可以正常工作。
嗯,这是模型:
def get_slug(self):
return self.safe_translation_getter(
'slug',
language_code=get_language(),
any_language=False)
def get_absolute_url(self, current_app=None):
"""
Warning: Due to the use of django application instance namespace
(for handle multi instance of an application)we add the possibility
to use it with the reverse.
So if get_absolute_url is call without app instance it may failed (
for example in django_admin)
"""
lang = get_language()
if self.has_translation(lang):
kwargs = {'slug': self.get_slug()}
return reverse('djangocms_showroom:project-detail',
kwargs=kwargs,
current_app=current_app)
return reverse('djangocms_showroom:project-list', current_app=current_app)
def get_full_url(self, site_id=None):
return self._make_full_url(self.get_absolute_url(), site_id)
def _make_full_url(self, url, site_id=None):
if site_id is None:
site = Site.objects.get_current()
else:
site = Site.objects.get(pk=site_id)
return get_full_url(url, site)
网址:
from django.conf.urls import patterns, url
from .views import (ProjectListView, ProjectDetailView)
urlpatterns = patterns(
'',
url(r'^$', ProjectListView.as_view(), name='project-list'),
url(r'^project/(?P<slug>\w[-\w]*)/$', ProjectDetailView.as_view(), name='project-detail'),
)
和html错误:
模板渲染期间出错
在模板/var/www/webapps/blippar_website/app/blippar/templates/djangocms_showroom/project_list.html中,第14行出错
这是:
<form id="projects-filter" action="{% url 'djangocms_showroom:project-list' %}">
嗯,我对django和django-cms不是很好,如果有人有任何线索,那就太棒了!