mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-21 07:22:14 +00:00
FEAT: Add associated assets to supplier detail view
This commit is contained in:
@@ -51,6 +51,14 @@ class Supplier(models.Model, RevisionMixin):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
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):
|
class Connector(models.Model):
|
||||||
description = models.CharField(max_length=80)
|
description = models.CharField(max_length=80)
|
||||||
|
|||||||
@@ -1,6 +1,73 @@
|
|||||||
{% extends 'base_assets.html' %}
|
{% extends 'base_assets.html' %}
|
||||||
{% block title %}Detail{% endblock %}
|
{% block title %}Supplier | {{ object.name }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ object }}
|
<div class="row">
|
||||||
{% endblock %}
|
{% if not request.is_ajax %}
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<h1>Supplier | {{ object.name }}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 text-right">
|
||||||
|
<div class="btn-group btn-page">
|
||||||
|
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
|
||||||
|
class="glyphicon glyphicon-pencil"></span> Edit</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="panel panel-info">
|
||||||
|
<div class="panel-heading">Supplier Details</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>Name</dt>
|
||||||
|
<dd>{{ object.name }}</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Associated Assets</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Asset ID</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Category</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th class="hidden-xs">Quick Links</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="asset_table_body">
|
||||||
|
{% with object.assets as object_list %}
|
||||||
|
{% include 'partials/asset_list_table_body.html' %}
|
||||||
|
{% endwith %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% if not request.is_ajax %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 text-right">
|
||||||
|
<div class="btn-group btn-page">
|
||||||
|
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
|
||||||
|
class="glyphicon glyphicon-pencil"></span> Edit</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="{% url 'supplier_update' object.pk %}" title="View Revision History">
|
||||||
|
Last edited {{ object.last_edited_at }} by {{ object.last_edited_by.name }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user