filmov
tv
Django Model Inheritance - InheritanceManager from django-model-utils

Показать описание
The django-model-utils package provides us an InheritanceManager that we can apply to the base class when we have a model inheritance tree.
This allows us to retrieve the correct subclasses when querying, rather than simply getting instances of the parent class,
We will add django-model-utils and use this InheritanceManager in this video.
We'll see the two methods it adds to our Django Querysets:
1. select_subclasses()
2. get_subclass()
▶️ Full Playlist:
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:31 Querying parent model in shell
03:04 Installing django-model-utils
03:39 Adding InheritanceManager to parent model
06:59 Querying with get_subclass() function
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
#django #python
This allows us to retrieve the correct subclasses when querying, rather than simply getting instances of the parent class,
We will add django-model-utils and use this InheritanceManager in this video.
We'll see the two methods it adds to our Django Querysets:
1. select_subclasses()
2. get_subclass()
▶️ Full Playlist:
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:31 Querying parent model in shell
03:04 Installing django-model-utils
03:39 Adding InheritanceManager to parent model
06:59 Querying with get_subclass() function
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
#django #python
Django Model Inheritance - InheritanceManager from django-model-utils
Django Model Inheritance - Abstract Models and Multi-Table Inheritance
Django : Django-model-utils: Use InheritanceManager with custom querysets
Django : django-model-utils: does InheritanceManager work if the parent model/class is abstract?
Django Template Filters - timesince and timeuntil
Django : Reorder model objects in django admin panel
Django : No module named 'model_utils'
DjangoCon 2021 | A SQL for Django | Stefan Baerisch
Django : How to get the object of self children from a parent-child relationship model
Does SQLAlchemy have an equivalent of Django's get_or_create?
DjangoCon 2022 | Why would anyone use Snowflake as a backend for Django?
Introduction of Django Model - Django Tutorial
Class parent and child part2 making battery class | Python and Django
DjangoCon 2020 | The Design and Development of Choices in Django 3.0 - Shai Berger
Django -04 - The Admin Tool
Django : Django treebeard what are differences between AL, NS, MP
DjancoCon 2021 WorkShop | Profiling Django & Python apps | Sümer Cip & Jérôme Vieilledent
Django : Django form validation: get child form data in parent
Django ORM. Be Careful|Tim Hsu|PyCon TW 2021
DjangoCon 2021 | Django with PostgreSQL Superpowers | Paolo Melchiorre
Django and HTMX #10 - Chained Dropdowns with Django and HTMX
Django : django - comparing django permissions and using django rules
Django : django's timezone.now does not show the right time
'Serverlessness - augmenting your Django apps with Functions-as-a-Service' by Tom Dyson
Комментарии