Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contradictory read_only and required arguments on a m2m through field with uniqueness constraint. #2813

Closed
mitchellrj opened this issue Apr 10, 2015 · 7 comments
Labels

Comments

@mitchellrj
Copy link

If a field is made read_only by DRF automatically by virtue of being a relation with a through-class and the field is also made required automatically by virtue of being used in a uniqueness constraint, the read_only and required arguments clash due to ModelSerializer.include_extra_kwargs only checking for read_only in extra_kwargs.

@tomchristie
Copy link
Member

Okay. Presumably the end result of that is that you'll always have a validation error for that field stating that: "this field is required", right?

@xordoquy
Copy link
Collaborator

xordoquy commented Jun 2, 2015

You should be able to get rid of the constraint by override the contraint. I wrote a mail about this yesterday on the mailing list.

@tomchristie
Copy link
Member

If anyone's able to search through the list and then link through to past discussion on this that'd help progress this issue.

@tomchristie tomchristie changed the title read_only and required on a field read_only and required arguments on a m2m through field with uniqueness constraint. Jun 23, 2015
@tomchristie
Copy link
Member

Note to self that #2882 is not the same as this issue.
Retitled to make the narrow scope of this issue more prominent.

@tomchristie tomchristie changed the title read_only and required arguments on a m2m through field with uniqueness constraint. Contradictory read_only and required arguments on a m2m through field with uniqueness constraint. Jun 23, 2015
@xordoquy xordoquy modified the milestone: 3.1.4 Release Jul 8, 2015
@xordoquy xordoquy modified the milestones: 3.1.4 Release, 3.1.5 Release Jul 16, 2015
@tomchristie tomchristie modified the milestones: 3.1.5 Release, 3.2.1 Release Jul 30, 2015
@tomchristie tomchristie modified the milestone: 3.2.1 Release Aug 7, 2015
@philippeluickx
Copy link

Linked to #2848 ?

@xordoquy
Copy link
Collaborator

@philippeluickx looks like, thanks for pointing it.

@tomchristie
Copy link
Member

Should now be resolved via #4192.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants