Reputation: 26727
Linking to a model instance is fairly easy in Django: reverse('admin:myapp_mymodel_change, args=(myinstance.pk,))
, but how do I link to the list (not the changelist) of objects that are of the MyApp.MyModel type?
My dirty hack works, but is a bit nasty:
admin_model_list = reverse('admin:myapp_mymodel_add')[:-5]
Upvotes: 0
Views: 59
Reputation: 118508
That is the changelist.
reverse('admin:myapp_mymodel_changelist') == reverse('admin:myapp_mymodel_add')[:-4]
Upvotes: 1