Dealing with nested relationships
See original GitHub issueHello,
I apologize if this isn’t the right place to ask this question, but I am having a rough time trying to get this package working with nested relationships. I have tried using DRFs built in solution, DRF-Flex-Fields, and Dynamic Rest. None of these options seem to be able to expand my sub-serializers and apply the DRF-Datatables formatting appropriately.
Instead, what is happening is that the nested relationships are being stripped away and only the first layer is being presented within the data:[...]
layer that is fed to the datatable.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Nested Relations
The nested relational model is an extension of the relational model in which domains may be either atomic or relation-valued. This allows a...
Read more >Nested Relational Databases - Rocket Software
Implicit relationship relations make the database schema simpler and allow it to directly reflect the relations between data in the database. The requirement ......
Read more >The two roles of nested relations in the DASDBS project
Abstract. The paper gives an overview of the nested relational model and its two roles in the Darmstadt Database System (DASDBS) project, which...
Read more >Nested Relations - AMiner
A nested relation can be decomposed (“flattened”) into a relation ... Nested relations are based on a type constructor for collection types.
Read more >Normal Form for Sets of Nested Relations - NUS Computing
nested relation is a relation which is either a NF2 relation or a normalized relation. ... The way to handle recursive relationship types...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t have much time to work on this, but the two quick and super-dirty options I’ve figured out so far are:
disabling
_filter_unused_fields()
entirely and allowing a more robust API field filtering package to take over (e.g. DRF-Flex-Fields).adding
col.split('.').pop(0)
to line 68 ofrenderers.py
as seen in my fork (warning: I haven’t written a unit test for this yet). This will search the top level of the data tree and maintain all subsequent serializers. It’s quick, it’s dirty, and I hate it, but I don’t really have time to think of a better way to recursively iterate through the data dict and filtering the appropriate fields at the appropriate level (i.e. recreating the Flex-Fields functionality).Fixed by https://github.com/izimobil/django-rest-framework-datatables/pull/7