I have an abstract model called ‘postmodel’
I have a model called ‘post’ that inherits from ‘postmodel’
I have another model called ‘event’ that inherits the ‘post’ model
I need ‘post’ to have its own category and ‘event’ to have its own category and ‘event’ should NOT inherit the category of ‘post’.
Is this possible?
category? Is it an attribute or a function?
What do you mean by “have its own” category?
An abstract model doesn’t create a physical model, it’s just a definition that can be inherited. Review the Model inheritance docs
post is not an abstract class, then if
event inherits from
event is physically created as a separate table with a one-to-one relationship with
Category is an attribute
Let me try and explain it with a better example using post and product(which is a post)
When I create a product I am forced to select the category for post as well, which I don’t want to do. I want to inherit all the fields from post but override the post category field with the product category field. Hope that is more clear
Actually, it would be more helpful if you posted the actual models you are using.
Yeah the problem with that is I keep on changing the code trying new things and looking to see how the database is created and how things work so I don’t keep the code for long before it is changed completely.
I have decided to just give everything it’s own app, so events will have it’s own app and posts will have their own app. Still early days for me learning the system