python - Django: Getting a link to admin page in a template -
i'm trying add together link in django template page handled default admin console. setup below, don't believe {% url %} part of equation right , i'm getting next error:
reverse 'profile_profilemodel' arguments '()' , keyword arguments '{}' not found.
how right , link admin console template.
template.html
<a href="{% url 'admin:profiles_profilemodel' %}">profiles</a>
profiles.models.py
class profile (models.model)
profiles.admin.py
class profileadmin (admin.modeladmin) admin.site.register (profile, profileadmin)
url.py
urlpatterns = patterns("", url(r"^admin/", include(admin.site.urls)),)
the name of changelist url model {{ app_label }}_{{ model_name }}_changelist
. in case, if app_label profiles
, model in profile
, view name profiles_profile_changelist
.
try following:
<a href="{% url 'admin:profiles_profile_changelist' %}">profiles</a>
see django docs on reversing admin urls more information.
python django django-templates django-admin admin
No comments:
Post a Comment