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

Fix bug - add publication comment #55

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def publish(self, data):
# Get or create publications
# Publications should be stored in the db before any data is stored
try:
publication_serializer = PublicationSerializer(data=publication_data)
publication_serializer = PublicationSerializer(data=publication_data, context={'user':user_obj})
# Validate the input data
if publication_serializer.is_valid(raise_exception=True):
# save and create publication obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def create(self, validated_data):
comment = validated_data.get('comment') # extra data - comment
number_of_families = validated_data.get('families') # extra data - families reported in publication

user_obj = self.context.get('user')

try:
publication_obj = Publication.objects.get(pmid=pmid)

Expand Down Expand Up @@ -266,7 +268,7 @@ def create(self, validated_data):
if comment is not None:
PublicationCommentSerializer(
# the user is necessary to save the comment
context={'user': self.context.get('user')}
context={'user': user_obj}
).create(comment, publication_obj)

# Add family info linked to publication
Expand Down
Loading