Django Model Inheritance - Abstract Models and Multi-Table Inheritance

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 19

  • @richardalcantara3495
    @richardalcantara3495 2 роки тому +2

    This is what I need for my project, I've been figuring out decent ways to avoid duplication of model content to each and every content I make in my project. Thanks you!

    • @bugbytes3923
      @bugbytes3923  2 роки тому

      Nice one, thank you for the comment!

  • @alaminbijoy1027
    @alaminbijoy1027 2 роки тому +1

    thanks man. Learned something new.

    • @bugbytes3923
      @bugbytes3923  2 роки тому

      Nice one man, thanks for commenting!

  • @stevepole1970
    @stevepole1970 2 роки тому +1

    Beautifully explained. Well done.

  • @danielcallaghan6892
    @danielcallaghan6892 2 роки тому +1

    aweome, very clear!

  • @DemelashShimekit
    @DemelashShimekit 5 місяців тому +1

    Thank you

  • @chaseeby100
    @chaseeby100 11 місяців тому

    Thank you!

  • @MagnusAnand
    @MagnusAnand 2 роки тому

    It would be cool if you could make a video about using composition in Django 💪

  • @MagnusAnand
    @MagnusAnand Рік тому

    An issue with Multiple Inheritance is that you can have a performance hiy if your database is too large, because in has to make joins for every query.

  • @fernandtape9363
    @fernandtape9363 2 роки тому +1

    Hi Bugbytes, thanks for this new video. Can this model inheritance be used in product variation of an eccommerce? If yes, how?

    • @bugbytes3923
      @bugbytes3923  2 роки тому +3

      Thanks for commenting.
      Yes, you may have multiple different types of products, each with their own fields. But there may be a common set of fields that you can define on a base class (this could be an abstract model, or you could go with the multi-table inheritance approach).
      For example, all products would have a "price", so it makes sense to use this on a base class.
      But certain products may have different, specific fields. A clothing product may have fields such as "size", whereas a food/drink product may have fields such as "calories". These would belong in the subclasses.
      I hope that makes sense!

  • @truthdawn7773
    @truthdawn7773 2 роки тому +2

    ❤️👌

  • @sarozpradhan64
    @sarozpradhan64 Рік тому

    I used field created_at and updated_at in CommonField class and inherited but how do i make sure that the created_at and updated_at columns are at last of the table because when i inherited it, it comes at first of the table.