Just facing the same problem with you bro, and i ended up with proxy model
and using django-treebeard for the data hierarchy...


On Thu, 11 Mar 2021 at 17.47 Kunal Solanke <kunalsolanke1...@gmail.com>
wrote:

> Btw parts should be a m2m field ig.
>
> On Thu, Mar 11, 2021, 16:14 Kunal Solanke <kunalsolanke1...@gmail.com>
> wrote:
>
>> That's too hard of a problem statement for me,ig more experienced people
>> will be able to answer it more properly. But if its 99.99% I'd go with
>> whatever you have right now, rather than creating bunch or proxy models.
>>
>> On Thu, Mar 11, 2021, 16:06 Mateusz Wroblewski <matw...@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> does anybody have experience with the following data model and could
>>> advise which Django tools fit it best?
>>>
>>> Background:
>>> I have two types of Components (Core and Complex) that share many
>>> attributes and methods, but also have their own, specific data fields and
>>> methods.
>>>
>>> What complicates the design is the fact, that ComplexComponent might
>>> have CoreComponents assigned to it. A CoreComponent instance might be a
>>> "self-standing" entity without any relation to ComplexComponent, but there
>>> are also CoreComponents created only for the purpose of "building"
>>> ComplexComponents.
>>> ComplexComponent (although complex :) ) might (or might not) use
>>> CoreComponents in its structure ("complexity" comes then from a different,
>>> unrelated feature).
>>>
>>> 99.99% of the time I need to be able to handle instances of
>>> CoreComponent (self-standing entities) and instances of ComplexComponent
>>> (with their linked core components) separately in different views/areas of
>>> my application, however I can envision some special use cases where I would
>>> need to use aggregation on both types to return data for some dash board
>>> type of views (e.g. average cost of all components created this year).
>>> Also, when a ComplexComponent is handled/displayed in the view, I need
>>> to be able to access CoreComponents that "compose" it (if applicable).
>>>
>>> I'm trying to figure out what Django tools to use for modelling this
>>> setup and would be thankful to hear your take on that problem.
>>>
>>> My current setup uses base Component concrete model and
>>> CoreComponent/ComplexComponent deriving from it (and also being concrete
>>> models).
>>> I end up with three different tables. Having core components and complex
>>> components in separate tables seemed right initially, but I know this
>>> approach might be difficult to handle down the road, so I'm thinking about
>>> restructuring it and using e.g. Proxy models instead? If I rebuild these
>>> models now, I would prefer to do it "right".
>>>
>>> Does anybody have experience with a similar (the same?) design and could
>>> advise what would be the best tool in Django to implement this?
>>>
>>> Below a simplified view of the classes in scope (only for demonstration
>>> purpose).
>>>
>>> Many thanks for any feedback.
>>>
>>> Have a nice day!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/36e6d27b-fd5d-4891-b999-0863a81ade85n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/36e6d27b-fd5d-4891-b999-0863a81ade85n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOecAnwV_Zi3%3DdrUnUkChszUHktP13GO3fKkso1EA3QGjDKvjw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAOecAnwV_Zi3%3DdrUnUkChszUHktP13GO3fKkso1EA3QGjDKvjw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJepfJXh0gdJF_OnQy0d5nEm89b7FLo%2BTy6-sK8U_f1x8kbFtw%40mail.gmail.com.

Reply via email to