Skip to content

Commit

Permalink
Merge pull request #55 from dglemos/fix/bug_add_publication
Browse files Browse the repository at this point in the history
Fix bug - add publication comment
  • Loading branch information
seeta-ramaraju authored Oct 17, 2024
2 parents 93e641c + ab0b331 commit b9f2ad4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit b9f2ad4

Please sign in to comment.