Skip to content

Commit

Permalink
Optimize inefficient related object id access in IAM checks
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max committed Jan 20, 2025
1 parent d8f9223 commit c382cc4
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 113 deletions.
6 changes: 4 additions & 2 deletions cvat/apps/engine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,10 @@ class AnnotationGuide(TimestampedModel):
is_public = models.BooleanField(default=False)

@property
def target(self):
return self.project or self.task
def target(self) -> Task | Project:
target = self.project or self.task
assert target # one of the fields must be set
return target

@property
def organization_id(self):
Expand Down
Loading

0 comments on commit c382cc4

Please sign in to comment.