3
Good morning guys, I’m starting now with Python and Django and I came up with a question in the creation of my models. I’d like to create something like:
Person(models. Model)
- Name
- ...
- Address
Address()
- Patio
- Neighborhood
- ...
That is, separate the address as an Object value so it can be used in more than one template. In the database the fields within the address class will be persisted within the People table and other entities that may arise (Company, Customer, "Anyone who may have an address"). So avoid duplicating all address fields for each model you need.
I saw that I could do setting the Meta of the address to Abstract and inheriting Address Person. Only if I want to do more Valueobjects I will have to inherit from several classes for that, I wonder if there is a more correct way.
Thank you.