Ask Your Question
0

In Django, why are the fields from the parent class not included in the table of the child class?

asked 2022-08-02 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-02-27 02:00:00 +0000

lakamha gravatar image

In Django, when a model inherits from another model, it creates a one-to-one relationship between the parent and child model. Therefore, the fields of the parent class are not included in the table of the child class since they are already present in the parent table. To access the fields of the parent class, you can use the dot notation to reference them from the child class.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-02 11:00:00 +0000

Seen: 16 times

Last updated: Feb 27 '22