-
Notifications
You must be signed in to change notification settings - Fork 300
-
Support for Polymorphic models have been added through PR #211 in 2017.
Recently, we had the issue #1190 opened stating that includes do not work with Django Polymorphic integration. As compound documents is a core feature of DJA I was wondering who is actually using Django Polymorphic at all with DJA nowadays? When going back to the original PR, there was only code review discussion. As far as I can see, there was no discussion on why Django Polymorphic should be added to DJA at all and what use cases it covers.
Why I am starting this discussion is that how Polymorphic has been implemented in DJA increased the complexity of Django JSON API especially the renderer and some util functions. This increased maintenance burden and also recently, we had to add workarounds to get new Python version support (#1185) as Django Polymorphic has not been updated for a while. Django Polymorphic has been moved to Jazzband though which hopefully will improve the situation in the future.
Personally, to avoid additional complexity to DJA for an optional feature, I think a support for Django Polymorphic would be best added in a third party app like django-restframework-json-api-polymprohic or similar. This way it certainly won't interfere with DJA core features and would help improve the API of the whole DJA library as well.
However, before we make any decision, I want to ask that the people who use Django Polymorphic with Django REST framework JSON:API speak up what there are exactly using it for. That would be very helpful to make a good decision on how to move forward.
Thanks for your feedback.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments 2 replies
-
As an update on this. Since opening this discussion almost two years ago, there has not been really any feedback.
My feeling is that either Django Polymorphic support in DJA is not used anymore or people are not aware of this surrounding discussion.
Through PR #1303 we have now deprecated Django Polymorphic support and pointing affected users to this discussion.
In case there are still users of Django Polymorphic support in DJA, our goal is, that we bring those together here and hopefully support for Django Polymorphic in DJA can be added through a 3rdParty library like django-polymorphic-json-api or similar.
If you are impacted by this deprecation, please speak up so we can see how we can move forward.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi! I work as a developer in an active production project that uses both libraries, so if you can recommend any path for upgrading or even create a third party library I'll appreciate it.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions
-
@pablopissi
Thanks for writing. Very much appreciated. Just to be clear, you can use both Django Polymorphic and Django REST framework JSON:API (DJA) in the same project even when support for Django Polymorphic in DJA will be dropped. The only thing which is not going to work anymore is to expose those polymorphic models as JSON:API compliant end points.
I assume that is what you do in your project, though? If yes, would you be willing to invest time to move the polymorphic logic into an external library?
This discussion actually has been around for a while, but hopefully, more people will speak up here once we make a new release with the deprecation. Ideal would be if a group could be formed to work on such a 3rdParty library, but someone will need to take the lead.
Once someone or a group of people is willing to invest time to extract this logic into an external library, I am happy to give hinters and assist.
There is not a lot of logic, but the tricky bits are how to extract the polymorphic logic currently directly integrated in the DJA renderer and parser itself into polymorphic specific classes.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi, we have just updated DJA to version 8.1.0. While testing we came across this issue. We use Django Polymorphic along with DJA. You would like to know what we exactly using it for. Well I'm not sure what to say but I suppose we are using it more or less as shown in the manual.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for writing. Great to see who is still using this polymorphic integration. The initial question is about the use case why polymorphic models are used in the first place in your project instead of plain Django models? And does the use case cover a part of JSON:API specification which without this polymorphic integration it otherwise would not?
Why this discussion has been raised is that the main goal of DJA is to implement the JSON:API to compliance, and that should be our focus.
For example: We also have support for django-filter which is an external library. As it is assisting us in integrating the filtering recommendation which is part of the JSON:API specification, we see that it should certainly be part of DJA.
Currently, we do not see that the django polymorphic models add any value specific to the JSON:API specification compliance (see also #1303) but is rather a support of an additional piece of another part of the Django ecosystem. If so, it is much better to be maintained by people who actually use Django polymorphic as a 3rdParty library than by the DJA team. See also Third Party Packages.
Beta Was this translation helpful? Give feedback.