Added URL field to UniquePart

- e.g. link to external part tracking info page
This commit is contained in:
Oliver 2018-04-16 01:25:13 +10:00
parent eb5413b4fa
commit f7eff8ae98
5 changed files with 32 additions and 12 deletions

View File

@ -4,10 +4,6 @@
{% include 'part/tabs.html' with tab='stock' %}
<br>
Total in stock: {{ part.stock }}
<br>
<table class="table table-striped">
<tr>
<th>Link</th>

View File

@ -22,6 +22,7 @@ class EditTrackedPartForm(forms.ModelForm):
fields = [
'part',
'serial',
'URL',
'customer',
'status'
]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-15 15:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('track', '0004_parttrackinginfo_user'),
]
operations = [
migrations.AddField(
model_name='uniquepart',
name='URL',
field=models.URLField(blank=True),
),
]

View File

@ -28,6 +28,9 @@ class UniquePart(models.Model):
serial = models.PositiveIntegerField()
# Provide a URL for an external link
URL = models.URLField(blank=True)
# createdBy = models.ForeignKey(User)
customer = models.ForeignKey(Customer, blank=True, null=True)

View File

@ -17,6 +17,12 @@
<td>Creation Date</td>
<td>{{ part.creation_date }}</td>
</tr>
{% if part.URL %}
<tr>
<td>URL</td>
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
</tr>
{% endif %}
{% if part.customer %}
<tr>
<td>Customer</td>
@ -34,14 +40,8 @@
<ul class='list-group'>
{% for info in part.tracking_info.all %}
<li class='list-group-item'>
<div class='panel panel-default'>
<div class='panel-heading'>
{{ info.title }}<span class="badge">{{ info.date }}</span>
</div>
{% if info.notes %}
<div class='panel-body'>{{ info.notes }}</div>
{% endif %}
</div>
{{ info.title }}
{% if info.note %}<br><i>{{ info.notes }}</i>{% endif %}<span class="badge">{{ info.date }}</span>
</li>
{% endfor %}
</ul>