Русские видео

Сейчас в тренде

Иностранные видео


Скачать с ютуб Django Model inheritance в хорошем качестве

Django Model inheritance 2 года назад


Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Django Model inheritance

#model #inheritance in #django works almost identically to the way normal class inheritance works in #python , but the basics at the beginning of the page should still be followed. That means the base class should subclass django.db.models.Model The only decision you have to make is whether you want the parent models to be models in their own right (with their own database tables), or if the parents are just holders of common information that will only be visible through the child models. There are three styles of inheritance that are possible in Django. 1. Often, you will just want to use the parent class to hold information that you don’t want to have to type out for each child model. This class isn’t going to ever be used in isolation, so #abstract base classes are what you’re after. 2. If you’re subclassing an existing model (perhaps something from another application entirely) and want each model to have its own database table, #Multi-table inheritance is the way to go. 3. Finally, if you only want to modify the Python-level behavior of a model, without changing the modelsfields in any way, you can use Proxy #models . #abstract base classes Abstract base classes are useful when you want to put some common information into a number of other models. You write your base class and put abstract=True in the Meta class. This model will then not be used to create any database table. Instead, when it is used as a base class for other models, its fields will be added to those of the child class

Comments