mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add 'keywords' field to Part
- Shows up in search results
This commit is contained in:
parent
7447561f77
commit
02033c2157
@ -157,6 +157,7 @@ class PartList(generics.ListCreateAPIView):
|
||||
'$name',
|
||||
'description',
|
||||
'$IPN',
|
||||
'keywords',
|
||||
]
|
||||
|
||||
|
||||
|
@ -92,9 +92,10 @@ class EditPartForm(HelperForm):
|
||||
'confirm_creation',
|
||||
'category',
|
||||
'name',
|
||||
'IPN',
|
||||
'variant',
|
||||
'description',
|
||||
'IPN',
|
||||
'keywords',
|
||||
'URL',
|
||||
'default_location',
|
||||
'default_supplier',
|
||||
|
18
InvenTree/part/migrations/0023_part_keywords.py
Normal file
18
InvenTree/part/migrations/0023_part_keywords.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2 on 2019-05-14 07:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0022_auto_20190512_1246'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='part',
|
||||
name='keywords',
|
||||
field=models.CharField(blank=True, help_text='Part keywords to improve visibility in search results', max_length=250),
|
||||
),
|
||||
]
|
@ -179,8 +179,9 @@ class Part(models.Model):
|
||||
Attributes:
|
||||
name: Brief name for this part
|
||||
variant: Optional variant number for this part - Must be unique for the part name
|
||||
description: Longer form description of the part
|
||||
category: The PartCategory to which this part belongs
|
||||
description: Longer form description of the part
|
||||
keywords: Optional keywords for improving part search results
|
||||
IPN: Internal part number (optional)
|
||||
URL: Link to an external page with more information about this part (e.g. internal Wiki)
|
||||
image: Image of this part
|
||||
@ -250,6 +251,8 @@ class Part(models.Model):
|
||||
|
||||
description = models.CharField(max_length=250, blank=False, help_text='Part description')
|
||||
|
||||
keywords = models.CharField(max_length=250, blank=True, help_text='Part keywords to improve visibility in search results')
|
||||
|
||||
category = models.ForeignKey(PartCategory, related_name='parts',
|
||||
null=True, blank=True,
|
||||
on_delete=models.DO_NOTHING,
|
||||
|
@ -62,15 +62,16 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
fields = [
|
||||
'pk',
|
||||
'url', # Link to the part detail page
|
||||
'full_name',
|
||||
'name',
|
||||
'variant',
|
||||
'image_url',
|
||||
'IPN',
|
||||
'URL', # Link to an external URL (optional)
|
||||
'description',
|
||||
'category',
|
||||
'category_name',
|
||||
'image_url',
|
||||
'full_name',
|
||||
'name',
|
||||
'IPN',
|
||||
'variant',
|
||||
'description',
|
||||
'keywords',
|
||||
'URL',
|
||||
'total_stock',
|
||||
'available_stock',
|
||||
'units',
|
||||
|
@ -35,16 +35,22 @@
|
||||
<td>Part name</td>
|
||||
<td>{{ part.full_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>{{ part.description }}</td>
|
||||
</tr>
|
||||
{% if part.IPN %}
|
||||
<tr>
|
||||
<td>IPN</td>
|
||||
<td>{{ part.IPN }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>{{ part.description }}</td>
|
||||
</tr>
|
||||
{% if part.keywords %}
|
||||
<tr>
|
||||
<td>Keywords</td>
|
||||
<td>{{ part.keywords }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if part.URL %}
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
|
Loading…
Reference in New Issue
Block a user