Skip to content

Commit

Permalink
Merge pull request #193 from djnunez-aot/bug-fix-notes
Browse files Browse the repository at this point in the history
Fix notes api - add post_dump method
  • Loading branch information
djnunez-aot authored Dec 6, 2024
2 parents 421ecdb + 758bfca commit 3f133c3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions submit-api/src/submit_api/schemas/submission_item_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Manages the package
"""

from marshmallow import EXCLUDE, Schema, fields, pre_dump
from marshmallow import EXCLUDE, Schema, fields


class SubmissionItemNote(Schema):
Expand All @@ -18,13 +18,13 @@ class Meta: # pylint: disable=too-few-public-methods
note = fields.Str(data_key="note")
item_id = fields.Int(data_key="item_id")
created_date = fields.DateTime(data_key="created_date")
created_by = fields.Str(data_key="created_by")
created_by = fields.Method('get_submitted_by')

@pre_dump
def get_submitted_by(self, obj, **kwargs):
"""Get created_by."""
obj.created_by = obj.created_by_user.account_user.full_name if obj.created_by_user else None
return obj
def get_submitted_by(self, obj):
"""Get submitted by."""
submitted_by = obj.created_by_user.account_user.full_name \
if obj.created_by_user and obj.created_by_user.account_user else None
return submitted_by


class PostSubmissionItemNote(Schema):
Expand Down

0 comments on commit 3f133c3

Please sign in to comment.