-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
[back] feat: add entity contexts to unconnected entities API #1873
[back] feat: add entity contexts to unconnected entities API #1873
Conversation
@@ -89,7 +89,7 @@ def to_representation(self, instance): | |||
poll = self.context.get("poll") | |||
ent_contexts = self.context.get("entity_contexts") | |||
|
|||
if poll is not None: | |||
if poll is not None and ent_contexts is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the cases where poll
or ent_contexts
would be None ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ExportComparisonsView
class uses the ComparisonSerializer
to write the comparisons of the logged user in a .csv file. In this case the serializer context doesn't contain any entity context.
If we consider that a comparison should not be represented without its related entity contexts, then we may want to remove this condition and ent_contexts is not None
. In this case we should also consider adding the entity contexts in the public dataset.
Because they are here to "bias" the comparisons I think it could be a good idea to include those entity contexts in the public dataset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an issue to address this question #1902
related issues #1852
Description
This PR adds the support of entity contexts in the unconnected entities API.
Moreover the logic used by the comparisons API and the unconnected entities API has been factorized in
PollScopedViewMixin
. Now all poll related views can access the entity contexts directly fromself.entity_contexts
.to-do
Checklist