Back to Browse

Django Model Inheritance - InheritanceManager from django-model-utils

2.1K views
Mar 15, 2022
8:53

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: https://www.youtube.com/playlist?list=PL-2EBeDYMIbQIu4aMZYqM6_w1ihIKWIql ๐Ÿ“Œ ๐—–๐—ต๐—ฎ๐—ฝ๐˜๐—ฒ๐—ฟ๐˜€: 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: https://ko-fi.com/bugbytes ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ: ๐Ÿ“– Blog: https://www.bugbytes.io/posts/ ๐Ÿ‘พ Github: https://github.com/bugbytes-io/ ๐Ÿฆ Twitter: https://twitter.com/bugbytesio ๐ŸŽถ TikTok: https://www.tiktok.com/@bugbytes.io ๐Ÿ“š ๐—™๐˜‚๐—ฟ๐˜๐—ต๐—ฒ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐—ฎ๐—ป๐—ฑ ๐—ถ๐—ป๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Model Inheritance: https://docs.djangoproject.com/en/4.0/topics/db/models/#model-inheritance django-model-utils:https://django-model-utils.readthedocs.io/en/latest/ #django #python

Download

1 formats

Video Formats

360pmp417.3 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Django Model Inheritance - InheritanceManager from django-model-utils | NatokHD