Added URL field to stock item

This commit is contained in:
Oliver 2018-04-16 21:07:57 +10:00
parent 835144c87f
commit 202a8e65b9
4 changed files with 31 additions and 1 deletions

View File

@ -49,5 +49,6 @@ class EditStockItemForm(forms.ModelForm):
'batch',
'quantity',
'status',
'customer'
'customer',
'URL',
]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-16 11:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0007_auto_20180416_0853'),
]
operations = [
migrations.AddField(
model_name='stockitem',
name='URL',
field=models.URLField(blank=True, max_length=125),
),
]

View File

@ -80,6 +80,9 @@ class StockItem(models.Model):
# Optional serial number
serial = models.PositiveIntegerField(blank=True, null=True)
# Optional URL to link to external resource
URL = models.URLField(max_length=125, blank=True)
# Optional batch information
batch = models.CharField(max_length=100, blank=True)

View File

@ -44,6 +44,12 @@
<td>Quantity</td>
<td>{{ item.quantity }}</td>
</tr>
{% if item.URL %}
<tr>
<td>URL</td>
<td><a href="{{ item.URL }}">{{ item.URL }}</a></td>
</tr>
{% endif %}
{% if item.supplier_part %}
<tr>
<td>Supplier Part</td>