Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adapt SerializerMethodResourceRelatedField behaviro to DRF SerializerMethodField #639

Closed
@David-Guillot

Description

Hi there,

DRF's SerializerMethodField makes it easy to avoid defining a method name as it auto-computes a method name by prepending get_ to the field source.

With DJA's SerializerMethodResourceRelatedField, one has to define the source attribute as without it, the method name conflicts with the field name (i'm not sure to be crystal-clear here 😕 ).

I find it:

  • Annoying (in a very minor way)
  • Not consistent with what developers are used to with vanilla DRF

So if you agree with me, i can probably open a PR that adds this bit of sugar (although i'm not sure to understand all the implications for the read/write use case, but i can give it a try).

So what do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /