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

ModelSerializer fails to generate fields for Models that inherit from an abstract base class Model #3117

Closed
erikcw opened this issue Jul 6, 2015 · 2 comments

Comments

@erikcw
Copy link
Contributor

erikcw commented Jul 6, 2015

I did some searching in the closed issues, and it looks like the decision was to raise an exception when attempting to use ModelSerializer with an abstract base class model. (#2757)

I have a model that inherits from an abstract base class model. No exception was thrown by DRF. Additionally, the Serializer doesn't generate the fields for the sub-class, instead it only renders the fields from the abstract base class.

If this isn't going to be supported, the assertion should probably check if the superclass is abstract and then fail loudly.

I'm on DRF 3.1.3.

@xordoquy
Copy link
Collaborator

xordoquy commented Jul 6, 2015

@erikcw The bug you are referring to is about using an abstract model with a ViewSet, not using a model that inherits from an abstract model.
Could you provide a test case about this ? I think already use models that inherits from an abstract class without any major issue.

@erikcw
Copy link
Contributor Author

erikcw commented Jul 6, 2015

My mistake.

@erikcw erikcw closed this as completed Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants