15

in the Django administration console, all section (menu links) come from models with database tables, but what would I need to do if I need a section without a corresponding model object (no database table) that fetches data from other section with model?

Any ideas? Thanks

Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
Asinox
  • 6,747
  • 14
  • 61
  • 89
  • 2
    "model (no database table) that bring me data from other section with model"? This isn't very clear. Can you provide a more complete definition of what you are talking about? – S.Lott Sep 04 '09 at 14:01
  • Hi guys, thanks for reply, well like Thierry said i want an admin uls with my owen view but this url dont have any model relation.. is just a link where a want to show the data from x database table... sorry my english :( – Asinox Sep 04 '09 at 15:22

2 Answers2

17

It looks like you want to add new admin urls with your own customized views and template: django.contrib.admin.ModelAdmin.get_urls

You can construct those new admins without a new model this way.

Community
  • 1
  • 1
Thierry Lam
  • 45,304
  • 42
  • 117
  • 144
-4

I did it with Proxy Models....

RickyA
  • 15,465
  • 5
  • 71
  • 95
Asinox
  • 6,747
  • 14
  • 61
  • 89
  • 4
    Could you explain how? – martinarroyo Oct 02 '17 at 09:27
  • ProxyModel doesnt make sense to use here. It is misleading. – Dinesh Mar 05 '18 at 12:20
  • 1
    (I'm using Django 3.0) In fact you can use proxy models to achieve that. You can create a proxy model on any model of your app, and register it with a ModelAdmin. Then the proxy model will show up in the admin dashboard as a normal model. Afterwards you have to overwrite the views (changelist_view, add_view, change_view, delete_view) to do whatever you want as you won't want to work on the proxied model. But it is a very hacky way to get something into the admin interface, which you normally not want to. – Gnietschow Jan 26 '21 at 17:18