5

I am looking for information on how to add entirely new pages to the django admin interface. I need to add a view that allows admins to change the contents of an existing text file. This view needs to exist within the existing django admin app. I am using django 1.9.

I found information on extending existing pages, but not adding entirely new pages. Is this possible?

mstagg
  • 507
  • 4
  • 16
  • You may want to take a look at this question: http://stackoverflow.com/questions/6583877/how-to-override-and-extend-basic-django-admin-templates – Ryan May 12 '16 at 16:08
  • Have a look at the docs on [`get_urls`](https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls). – Alasdair May 12 '16 at 16:09
  • @Alasdair That was it. Took me a hot minute to find it. Django docs are great, but there is alot of info to sift through! – mstagg May 12 '16 at 17:58
  • @mstagg Great, glad it helped. Django docs are good, but it can be tricky if you don't know exactly what you're looking for. – Alasdair May 12 '16 at 19:36

1 Answers1

1

Once you've written your view, you can include it in the admin by overriding get_urls.

An alternative is to override the AdminSite class, which also has a get_urls method. However this will require changing more code if you are not already using a custom AdminSite subclass.

Alasdair
  • 298,606
  • 55
  • 578
  • 516