Django Admin Tutorial - Full Customization (2018)
Автор: The Dumbfounds
Загружено: 2018-06-26
Просмотров: 177996
7 Tips For Getting Better At Django:
https://mailchi.mp/dea592ab3f6d/tips-...
In this video you will learn how to customize the django admin view.
django-suit package license:
http://djangosuit.com/pricing/
Starting point for this tutorial:
https://github.com/Rechunk/snippetpro...
You are going to learn:
how to register and unregister models
how to add filtering
how to add a custom input and button which update a field on all objects
how to change the theme using the django-suit package.
Registering and unregistering models is quite easy. Simple use the admin.site.register/admin.site.unregister functions and provide them with the model.
In order to take our customization further, we'll then create an admin class for the snippet and alter various attributes, such as filter, exclude, list_display, list_filter.
To include an input with a button, we'll need to override the change_list_template attribute and set it to our desired path. In the template, we'll then extend from admin/change_list.html, and can now override the various blocks. For our custom behaviour to work, we'll set up a form with an action, override the get_urls() to include a custom path we'll create that the form will then navigate to, and finally write a view that will handle our request.
Configuring our custom theme is easy. We'll pip install django-suit, create a custom SuitConfig and include it in our INSTALLED_APPS in the settings.py. Now, we can alter the SuitConfig attributes to "suit" (that wordplay...) our needs.
Anyway, you can find the step-by-steps instructions in this video.
If you enjoyed this video, make sure to subscribe and share it with anyone you think could enjoy it as well.
I hope to see you inside of the next episode,
Cheers.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: