diff --git a/assets/models.py b/assets/models.py index 2398a563..fcf93207 100644 --- a/assets/models.py +++ b/assets/models.py @@ -51,6 +51,14 @@ class Supplier(models.Model, RevisionMixin): def __str__(self): return self.name + @property + def assets(self): + p = [] + for e in Asset.objects.filter(purchased_from=self): + p.append(e) + + return p + class Connector(models.Model): description = models.CharField(max_length=80) diff --git a/assets/templates/supplier_detail.html b/assets/templates/supplier_detail.html index 7639cf6b..ddbb7817 100644 --- a/assets/templates/supplier_detail.html +++ b/assets/templates/supplier_detail.html @@ -1,6 +1,73 @@ {% extends 'base_assets.html' %} -{% block title %}Detail{% endblock %} +{% block title %}Supplier | {{ object.name }}{% endblock %} {% block content %} -{{ object }} -{% endblock %} \ No newline at end of file +
+ {% if not request.is_ajax %} +
+

Supplier | {{ object.name }}

+
+ +
+
+ Edit +
+
+ {% endif %} +
+
+
Supplier Details
+
+
+
Name
+
{{ object.name }}
+
+
+
+
+
+ +
+
+
+
Associated Assets
+
+ + + + + + + + + + + + {% with object.assets as object_list %} + {% include 'partials/asset_list_table_body.html' %} + {% endwith %} + +
Asset IDDescriptionCategoryStatus
+
+
+
+
+ + + {% if not request.is_ajax %} +
+
+
+ Edit +
+
+ + Last edited {{ object.last_edited_at }} by {{ object.last_edited_by.name }} + +
+
+
+ {% endif %} +{% endblock %}