Skip to content

DRAFT: Polymorphism post and patch support #240

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

Closed
wants to merge 9 commits into from

Conversation

ograycode
Copy link

@ograycode ograycode commented May 13, 2016

This is based off of @leo-naeka's pull #211, and I do not consider it merge-able in it's current state. That said, I wanted to get early feedback from this project's maintainers on the direction of the pull request as well as know what I can do to help get this functionality in.

The pull request builds on #211 in the following ways:

  • updates leo-naeka's original work to be compatible with current HEAD of develop.
  • adds support and tests for patch requests on a polymorphic model's -detail endpoint.
  • adds support and tests for post requests on a polymorphic model's -list endpoint.
  • fixes includes json structure and -detail json structure to use fields defined by the polymorphic serializer's child fields property.

TODO:

  • clean up git history
  • test relationship endpoints.
  • move a lot of ProjectSerializer into a more generic polymorphic serialize.
  • Update documentation.
  • remove pdb # b comment.

(I did this work because #211 had not been updated in about a month and my team was running up against this issue).

@leo-naeka
Copy link
Contributor

Thanks @ograycode, looks great!

Indeed, my preliminary work was not complete then definitely not merge-able. I'm thrilled that there's so much interest in polymorphic support these days.
I had just been able to free myself a little time to work on it these days, so I'm totally open to code with you on this and contribute to this PR.

@@ -9,7 +9,6 @@
class Migration(migrations.Migration):

dependencies = [
('contenttypes', '0002_remove_content_type_name'),
Copy link
Contributor

@leo-naeka leo-naeka May 13, 2016

Choose a reason for hiding this comment

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

('contenttypes', '0001_initial'), is still needed: 0002 has been introduced in Django 1.8 and 1.7 is still supported by the lib (btw shouldn't support be dropped since it reached its end of life @jerel ?).

Copy link
Author

Choose a reason for hiding this comment

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

I had removed it because I thought the dependency was breaking the older django versions (<1.7) on test. I think I'm wrong though.

Copy link
Contributor

Choose a reason for hiding this comment

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

It breaks on Django 1.7 since migration 0002 does not exist (added in 1.8). But for the purpose of this migration, the initial content type migration seems fine as a dependency.

@ograycode
Copy link
Author

ograycode commented May 13, 2016

@leo-naeka great to see your response. I'll clean up the git history in my repo this afternoon. Then you should be able to base any additional work you do on it. Once the git cleanup is done, you can submit pull requests against my repo and I'll merge them into the polymorphism branch, or, alternatively, I can give you collaborator status on the repo.

- support for post and patch request on polymorphic model endpoints.
- makes polymorphic serializers give child fields instead of its own.
@ograycode
Copy link
Author

@leo-naeka I have cleaned up the git history of this branch. I don't plan on doing any more interactive rebases, so it can be worked on you now.

@leo-naeka
Copy link
Contributor

Thanks @ograycode!

For the moment, I'll fork your code, then fill you some PR. You may want to give me the collaborator status later, if necessary.

@ograycode
Copy link
Author

my colleague @tpilara will be taking over for me and will be working towards completing this.

@stianpr
Copy link

stianpr commented Aug 16, 2016

my colleague @tpilara will be taking over for me and will be working towards completing this.

Any progress on this patch @ograycode and @tpilara? If not then can you outline what is missing and how we can get in a better merge state. We haven't tested it yet on our code base, but we would like to help if possible.

@leo-naeka
Copy link
Contributor

Since I'm the main developer on this and I want to move forward (but having no permissions on ZeroCater/django-rest-framework-json-api), I propose to take the lead and continue with this on my original PR #211. Then, this one could be closed.
Are you ok with this @ograycode, @tpilara ?

cc @stianpr

@birkholz
Copy link
Contributor

birkholz commented Sep 6, 2016

@leo-naeka I work at ZeroCater with @ograycode and @tpilara. We replaced our polymorphic models, so it's best if you take over this.

@leo-naeka
Copy link
Contributor

Ok, thanks. So this PR should be closed @jerel, I'm taking over on #211

@scottfisk scottfisk closed this Sep 8, 2016
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

Successfully merging this pull request may close these issues.

5 participants