2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Display 'starred' status on the Part information page

This commit is contained in:
Oliver Walters
2019-05-05 10:54:21 +10:00
parent b2e935382b
commit bbd164407f
3 changed files with 16 additions and 1 deletions

View File

@ -247,6 +247,15 @@ class Part(models.Model):
return total
def isStarredBy(self, user):
""" Return True if this part has been starred by a particular user """
try:
PartStar.objects.get(part=self, user=user)
return True
except PartStar.DoesNotExist:
return False
def need_to_restock(self):
""" Return True if this part needs to be restocked
(either by purchasing or building).