質問

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