문제

I want to create a home page containing a list of feincms pages and linked to their url.

I am trying

{% url page_obj.get_absolute_url %} 

which is throwing an error

Reverse for '/test/' with arguments '()'

The feincms page resides at localhost/test/

I have included the following in the urls.py

urlpatterns += patterns('',
    url(r'', include('feincms.contrib.preview.urls')),
    url(r'', include('feincms.urls')),
)
도움이 되었습니까?

해결책

get_absolute_url() already returns the final URL. There's no need to pass it to the {% url %} templatetag. Just do a variable substition in your template:

<a href="{{ page_obj.get_absolute_url }}">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top