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',
|
'$name',
|
||||||
'description',
|
'description',
|
||||||
'$IPN',
|
'$IPN',
|
||||||
|
'keywords',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,9 +92,10 @@ class EditPartForm(HelperForm):
|
|||||||
'confirm_creation',
|
'confirm_creation',
|
||||||
'category',
|
'category',
|
||||||
'name',
|
'name',
|
||||||
|
'IPN',
|
||||||
'variant',
|
'variant',
|
||||||
'description',
|
'description',
|
||||||
'IPN',
|
'keywords',
|
||||||
'URL',
|
'URL',
|
||||||
'default_location',
|
'default_location',
|
||||||
'default_supplier',
|
'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:
|
Attributes:
|
||||||
name: Brief name for this part
|
name: Brief name for this part
|
||||||
variant: Optional variant number for this part - Must be unique for the part name
|
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
|
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)
|
IPN: Internal part number (optional)
|
||||||
URL: Link to an external page with more information about this part (e.g. internal Wiki)
|
URL: Link to an external page with more information about this part (e.g. internal Wiki)
|
||||||
image: Image of this part
|
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')
|
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',
|
category = models.ForeignKey(PartCategory, related_name='parts',
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
on_delete=models.DO_NOTHING,
|
on_delete=models.DO_NOTHING,
|
||||||
|
@ -62,15 +62,16 @@ class PartSerializer(serializers.ModelSerializer):
|
|||||||
fields = [
|
fields = [
|
||||||
'pk',
|
'pk',
|
||||||
'url', # Link to the part detail page
|
'url', # Link to the part detail page
|
||||||
'full_name',
|
|
||||||
'name',
|
|
||||||
'variant',
|
|
||||||
'image_url',
|
|
||||||
'IPN',
|
|
||||||
'URL', # Link to an external URL (optional)
|
|
||||||
'description',
|
|
||||||
'category',
|
'category',
|
||||||
'category_name',
|
'category_name',
|
||||||
|
'image_url',
|
||||||
|
'full_name',
|
||||||
|
'name',
|
||||||
|
'IPN',
|
||||||
|
'variant',
|
||||||
|
'description',
|
||||||
|
'keywords',
|
||||||
|
'URL',
|
||||||
'total_stock',
|
'total_stock',
|
||||||
'available_stock',
|
'available_stock',
|
||||||
'units',
|
'units',
|
||||||
|
@ -35,16 +35,22 @@
|
|||||||
<td>Part name</td>
|
<td>Part name</td>
|
||||||
<td>{{ part.full_name }}</td>
|
<td>{{ part.full_name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Description</td>
|
|
||||||
<td>{{ part.description }}</td>
|
|
||||||
</tr>
|
|
||||||
{% if part.IPN %}
|
{% if part.IPN %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>IPN</td>
|
<td>IPN</td>
|
||||||
<td>{{ part.IPN }}</td>
|
<td>{{ part.IPN }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% 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 %}
|
{% if part.URL %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>URL</td>
|
<td>URL</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user