i wanna Move user to admin panel site in Django using {% url 'admin' %} but the problem is my template in rendering in an app and i dont wanna rewrite url("^admin/",admin.site.urls)
in project/site/urls.py
here it is
urlpatterns = [
url(r"^admin/", admin.site.urls, name="admin"),
url(r"^", include("core.urls")),]
urlpatterns = [
url(r"^$",indexView.as_view() ,name="index" ),
]
accountspattenrns = {
url(r"^accounts/signup/$",signupView.as_view() ,name="signup" ),
url(r"^accounts/login/$",loginView.as_view() ,name="login" ),
url(r"^accounts/logout/$",logoutView.as_view() ,name="logout" ),
url(r"^accounts/profile/$",ProfileView.as_view() ,name="profile" ),
}
urlpatterns +=accountspattenrns
<li><a href="{% url 'admin' %}"><i class="fa fa-black-tie fa-2x"></i>
<div>Admin</div></a></li>
Try reversing the URL using admin namespace
{% url 'admin:index' %}
Refs: Django docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With