Home > database >  Can't create links to any Django admin templates beside index.html?
Can't create links to any Django admin templates beside index.html?

Time:04-11

I'm trying to create a link to Django's admin/auth/user/add/ to let users create an account to login with. This is when I ran into the problem that even though setting

href="{% url 'admin:index' %}"

works for linking to the admin's index.html, replacing index with any other template's name doesn't work. So, I have no way of adding new accounts.

CodePudding user response:

To reverse an admin URL you can follow the patterns here

The URL name for the add page for a model is {{ app_label }}_{{ model_name }}_add, the url you want is

{% url 'admin:auth_user_add' %}
  • Related