Skip to content

Commit

Permalink
min_media to return virtual only
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Feb 6, 2024
1 parent cedc8f9 commit 7503335
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manager/manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,11 @@ def get_choices(cls, *, kind=None, display_units=True):

@classmethod
def get_min_for(cls, size):
matching = [media for media in cls.objects.all() if media.bytes >= size]
matching = [
media
for media in cls.objects.filter(kind=cls.VIRTUAL) # assume virtual
if media.bytes >= size
]
return matching[0] if len(matching) else None

def __str__(self):
Expand Down

0 comments on commit 7503335

Please sign in to comment.