记录一下Django Admin各个url名称
Reversing admin URLs in Django
The AdminSite
provides the following named URL patterns
Page | URL name | Parameters |
---|---|---|
Index | index | |
Logout | logout | |
Password change | password_change | |
Password change done | password_change_done | |
Application index page | app_list | app_label |
Redirect to object’s page | view_on_site | content_type_id, object_id |
Each ModelAdmin
instance provides an additional set of named URLs
Page | URL name | Parameters |
---|---|---|
Changelist | {{ app_label }}_{{ model_name }}_changelist | |
Add | {{ app_label }}_{{ model_name }}_add | |
History | {{ app_label }}_{{ model_name }}_history | object_id |
Delete | {{ app_label }}_{{ model_name }}_delete | object_id |
Change | {{ app_label }}_{{ model_name }}_change | object_id |
If you want to get a reference to the Change view for a particular Post object (from the posts application) in the default admin
from django.urls import reverse post = Post.objects.get(pk=7) change_url = reverse('admin:posts_post_change', args=(post.id,))
refrence: https://en.proft.me/2014/10/12/reversing-admin-urls-django/
I think I sould write some posts in English someday.