A
A
Astrohas2018-11-05 20:34:22
Django
Astrohas, 2018-11-05 20:34:22

How to create your own custom admin panel with Django?

So, comrades, in the life of every django player, there probably comes a time when the capabilities of the standard Django admin panel are not enough, and the customer asks for a separate one, with a twist, blackjack and hookers.
So, that turning point has come in my life - the customer asked for such an admin panel, with access control, a beautiful interface, diagrams, pentagrams and other tools. So be it.
At first I wanted to do everything in the Backend -> Rest API -> SPA on React, but already in the second minute I realized that for each model I would have to create forms manually on the front side, and I didn’t want to lose such pluses as standard Django forms.
Therefore, I gave up on all this fashion with SPA, and decided to simply cut everything on the side of the back, using the old-fashioned way. I took the Orthodox admin_lte2, and then went into reboot - how can I do all this miracle in the most universal way and so that I don’t have to rewrite kilotons of code to add a new model to the admin panel. Using the skills of googling, I found the django-admin2 library , this is an analogue of the standard admin panel, rewritten in CBV. It looks like you can use it. But how right way am I going?
So I would like to know from the toasters how and with what help they made a custom admin panel ... Thank you in advance.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gornostaev, 2018-11-06
@sergey-gornostaev

I often see claims that "the standard Django admin is missing". In 9 cases out of 10, this means that the author of the application has not fully read the documentation and does not represent the full range of possibilities for customizing the standard admin panel. In the remaining one case, the author of the statement really went beyond, but in this case the requirements turn out to be so specific that even CRUD CBVs cease to fit under them, not to mention any batteries. Therefore, the answer is: To get your admin panel, write your own views and templates. There are no fundamental differences from the development of any other views.

F
FulTupFul, 2018-11-05
@FulTupFul

You are on the right path, you are a traveler. It is best to add a standard admin panel. Django provides a lot of scope for customization.
The main allies in this matter for you will be:
the get_queryset () method that allows you to intercept the queryset - https://docs.djangoproject.com/en/2.1/ref/contrib/...
changelist_view, change_view, etc. method. will allow you to forward any content you want - https://docs.djangoproject.com/en/2.1/ref/contrib/...
You can also rewrite templates for yourself - https://docs.djangoproject.com/en/2.1 /ref/contrib/...
You can intercept queryset before or after deletion or creation - https://docs.djangoproject.com/en/2.1/ref/contrib/...
Basically, you can do whatever you want.

A
Aleksey Solovyev, 2018-11-05
@alsolovyev

In one project I used jet.geex-arts.com Redrawn
admin panel with additional features. It's very easy to write your own modules for the main page: https://jet.readthedocs.io/en/latest/dashboard_cus...
Now they have released the second version , which has radically changed in appearance for the better.
You can see in the source how it was implemented.

Y
Yura Khlyan, 2018-11-07
@MAGistr_MTM

The Django Oscar( https://github.com/django-oscar/django-oscar) has its own admin panel. All actions are only in it. You can see how it's implemented.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question