Skip to content

Commit

Permalink
Improve lookup efficiency for datasheet attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Jun 24, 2024
1 parent ab386e9 commit b33b273
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions inventree_kicad/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,7 @@ def get_datasheet(self, part):
and return the first one which has a comment matching "datasheet"
"""

datasheet = None

for attachment in part.attachments.all():
if attachment.comment.lower() == 'datasheet':
datasheet = attachment
break
datasheet = part.attachments.filter(comment__iexact='datasheet').first()

if datasheet:
try:
Expand Down

0 comments on commit b33b273

Please sign in to comment.