Coder Social home page Coder Social logo

Comments (8)

russian-developer avatar russian-developer commented on August 13, 2024 4

Everybody wants it but nobody what to do anything :D

from drf-flex-fields.

cdrx avatar cdrx commented on August 13, 2024 2

@rsinger86 this is something I need. I will gladly work up a PR, but could you please give me some guidance on the best way to implement it?

from drf-flex-fields.

rsinger86 avatar rsinger86 commented on August 13, 2024 1

Ah yes, thanks for noting this. This does not currently work, but I will certainly look into adding support for it. The current assumption is that your request for sparse fields gets injected into a dynamic serializer that is defined in the expandable_fields property. Serializers set up in the conventional manner as in your AddressBookSerializer example do not receive this input. However, there are ways of doing this, such as looking to the serializer parent for the fields input.

from drf-flex-fields.

striveforbest avatar striveforbest commented on August 13, 2024 1

Is it still in limbo?

from drf-flex-fields.

rajagopalx avatar rajagopalx commented on August 13, 2024

Ohh. Okay. Thanks for Good Library. 👍

from drf-flex-fields.

cdrx avatar cdrx commented on August 13, 2024

@rsinger86 checking in again 2.5 years later :) I'm still happy to work up a PR fixing this if you can give me a steer on where to look.

from drf-flex-fields.

rsinger86 avatar rsinger86 commented on August 13, 2024

Sure! I appreciate the bump.

I think you could work from the apply_flex_fields method to pass the correct values to the child fields:
https://github.com/rsinger86/drf-flex-fields/blob/master/rest_flex_fields/serializers.py#L53

Normally, the expand, fields and omit options get set in the constructor:
https://github.com/rsinger86/drf-flex-fields/blob/master/rest_flex_fields/serializers.py#L36

But in this case, I don't think that's possible so maybe you want to add an set_flex_options method to the FlexFieldsModelSerializer, which can be called from the parent serializer.

from drf-flex-fields.

by-Exist avatar by-Exist commented on August 13, 2024

I am having the same problem. Hope that solves the problem.

from drf-flex-fields.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.