Need a "starting point" for tips on adding a tabbed interface to the Django admin
I'm new to the world of web development - that means I'm new to javaScript / CSS. Now I am creating a web system with Python Django. I'm wondering if you would like to give me some advice as a starting point for adding a tabbed interface to Django admin?
For example, there are 3 detail tables for the main table and I want to use 3 different tabs to edit the 3 detail tables on the edit page for the main table. Thanks in advance!
a source to share
First of all, you need to decide whether to allow it with javascript or override templates. Both are good solutions depending on your requirements.
One easy way to do this, and the first approach you can take to start testing, is to put each tab in a different fieldset and then create a tabbed interface to show / hide them. It's the pros that this is a really easy way to do it, the cons that you don't have much flexibility without going over a lot of DOM from javascript.
You should keep in mind that if you change tabs, the user might forget they changed something and left without saving, so warning them that they are leaving the page rather than saving is always a good idea.
Another approach is to override the change_form template for that particular model and associate the new tabs with the same URL but with different GET parameters, like .... / mymodel /? active_tab = 2 and check this in template / view and display the appropriate content. Most notably, this is done so that the user does not need to enable javascript.
You can check how django-cms does it . It has a very nice tabbed interface for changing between different languages. One of the best ways to decide how to start doing something is to check how others have done it. Browser source code, install it and start experimenting!
Hope it helps.
EDIT
Another example is here . It's easier to just go through the attached patch than the complete django-cms code. Greetings.
a source to share