From bbd164407f30cf80ba16a62649afc87c01a98cc3 Mon Sep 17 00:00:00 2001
From: Oliver Walters
Date: Sun, 5 May 2019 10:54:21 +1000
Subject: [PATCH] Display 'starred' status on the Part information page
---
InvenTree/part/models.py | 9 +++++++++
InvenTree/part/templates/part/part_base.html | 4 +++-
InvenTree/part/views.py | 4 ++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py
index 06b79417d1..e5497faa4c 100644
--- a/InvenTree/part/models.py
+++ b/InvenTree/part/models.py
@@ -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).
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index 4ee5665be7..7381332892 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -28,7 +28,9 @@