Skip to content

Conversation

@aminiun
Copy link
Contributor

@aminiun aminiun commented Jun 24, 2023

My real scenario is when I include some fields that does not exists in the model. For example assume that I have a model called Store, which does not have token field.

In this example, if I have a ModelSerializer like this:

class StoreSerializer(ModelSerializer):
    ...
    class Meta:
        fields = (
            ...
            "token"
        )

Then I will face an exception like: 'Field name `token` is not valid for model `Store`.' .

This can really be a headache, when I have multiple serializers for Store model. So I suggest to simply have the model path, to be more clear about which serializer is corrupt.

@auvipy auvipy self-requested a review June 24, 2023 06:32
@aminiun
Copy link
Contributor Author

aminiun commented Jun 24, 2023

@auvipy I couldn't figure out why CI / Python 3.9 job failed. Isn't it a problem with CI ? Or my PR made this happen

@auvipy
Copy link
Collaborator

auvipy commented Jun 24, 2023

that is unrelated with your PR

@aminiun
Copy link
Contributor Author

aminiun commented Jul 8, 2023

@auvipy Any plan for this PR ?

Copy link
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be a good usability improvement

@auvipy auvipy added this to the 3.15 milestone Jul 25, 2023
@auvipy auvipy merged commit 5c3b6e4 into encode:master Jul 25, 2023
math-a3k pushed a commit to math-a3k/django-rest-framework that referenced this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants