2

Let's say I have 3 models, a company, its divisions, and the divisions' employees. Divisions have a foreign key to companies and employees have a foreign key to divisions. Is there a way to make it work so that the list display in the django admin for companies does something like:

General Electric
    Finance
            Tom Brown
            Bill Black
            John Green
    Technology
            Deer Rabbit
    Marketing
Target
    ...
zallarak
  • 5,287
  • 7
  • 38
  • 54
  • How about this answer http://stackoverflow.com/questions/11151603/can-i-use-the-djangos-default-admin-app-for-this-model/11151858#11151858 – dilip kumbham Jun 22 '12 at 11:32

1 Answers1

1

Yes totally, to be able to do that you will have to customize your admin views, here are the docs: http://www.djangobook.com/en/1.0/chapter17/

There is very similar example in the docs so it should be easy to follow :)

Hassek
  • 8,715
  • 6
  • 47
  • 59
  • Where is the similar example if you dont mind pointing me to it? – zallarak Jun 21 '12 at 18:04
  • sure, if you see the fire 17-2 it shows some header fields with subclasses, in you case you would only need to change those headers to be urls too. It is around the end of the page – Hassek Jun 21 '12 at 18:07
  • Thanks. That helps but is not exactly what Im looking for. I dont want to modify the existing template, just admin.py. I feel like this should be possible.. – zallarak Jun 21 '12 at 18:15
  • you can extend the template, no need to build it from scratch, I don't think there is a cleaner way to do this, but if you found another I would love to know. bests of luck! – Hassek Jun 21 '12 at 18:43