0

I am creating small web-application using django, which needs to have 4 different levels of access. I have created models and Admin page does 80% of what I would have expected (for most privileged user which is Admin), and I really like the default admin look of the page. I am unsure whether I should just extend Admin view, but I wish to use the default UI for all users (with small changes like different colors or navbar related to their level of access) - how can I do it? Can I use default templates/views of models and slightly change them/add new ones based on them without simply extending Admin view? I am new to web applications and I am currently stuck.

I just like the default UI and look and I hope there is an easy way to implement that look, so it would ease the UI part for me.

Tl;dr how can I keep default UI for the whole page

afdkj
  • 3
  • 3
  • You can extend / override the admin templates: https://stackoverflow.com/questions/6583877/how-to-override-and-extend-basic-django-admin-templates – Tomek Jan 20 '21 at 01:38
  • But is it something I should do, if I plan on having different levels of access? I would like to know if/what to copy to not extend admin, but have the similar look of it – afdkj Jan 20 '21 at 01:42
  • What you are saying doesnt make much sense to me, maybe i am misunderstanding your request / question. If you dont want to extend or override it then you need to write your own backend, or copy the original out to your local project and start editing them as required. – Tomek Jan 20 '21 at 01:47
  • Sorry, there is a big chance that what I am saying doesn’t make sense! So I will try to be a little more clear. I like how admin UI looks like, but I am unsure if I should extend it. My application basically needs to have 4 levels of access (admin, normal user Etc), so I thought about copying the default look and customizing it without extending admin, and that’s why I am asking if and how to do it. But is it possible to extend my Admin to achieve that goal of having 4 different levels of access with different navbars etc for different users? – afdkj Jan 20 '21 at 01:55
  • overriding would exactly be that, taking a copy from the django templates and putting them locally on your app/project and then applying the necessary changes. – Tomek Jan 20 '21 at 02:04

1 Answers1

0

It is possible but since the admin UI is tightly tied to the Django logic, it will be very hard to reproduce the looks and feel out of the box. Again, if you wish to do that you need to dig deep into the link I have provided, you need to extends them and understand how they are built in order to copy them. Short answer it is possible but very inconvenient.

If you question is, should I extend it to my users, the answer from the official documentation is clear:

The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.

However, it is very easy to customize and extends the basics function (though you can customize about anything) by overriding the template

If you want to have different admin page, with looks and behaviour, you can define different instance of the admin object

Gaëtan GR
  • 1,380
  • 1
  • 5
  • 21
  • I don't think it answers my questions. I don't really want to extend admin to my users and I don't want to have different admin page. I want my page to have same/similar admin-look UI for the whole page, but not by extending it. I would just like to reuse the original templates or views, and I am asking how to do it. – afdkj Jan 20 '21 at 13:23
  • It is possible but since the admin UI is tightly tied to the Django logic, it will be very hard to reproduce the looks and feel out of the box. Again, if you wish to do that you need to dig deep into the link I have provided, you need to extends them and understand how they are built in order to copy them. Short answer **it is possible but very inconvenient** – Gaëtan GR Jan 20 '21 at 13:46
  • Thank you very much! That pretty much sums it up :). I thought about it because I thought it might be easier, but it turned out it is completely other way around :) thanks – afdkj Jan 21 '21 at 00:46
  • glad it helps, I have edited my question so users can find the correct answer, please mark it as resolved with my answer to help other @afdkj – Gaëtan GR Jan 21 '21 at 08:43