mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Add PartParameter table
This commit is contained in:
parent
3447123196
commit
2f6357b136
23
InvenTree/part/migrations/0014_partparameter.py
Normal file
23
InvenTree/part/migrations/0014_partparameter.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 2.2.4 on 2019-08-20 02:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('part', '0013_auto_20190628_0951'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PartParameter',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(help_text='Parameter Name', max_length=100)),
|
||||||
|
('data', models.CharField(help_text='Parameter Value', max_length=100)),
|
||||||
|
('part', models.ForeignKey(help_text='Parent Part', on_delete=django.db.models.deletion.CASCADE, related_name='parameters', to='part.Part')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -1028,6 +1028,28 @@ class PartStar(models.Model):
|
|||||||
unique_together = ['part', 'user']
|
unique_together = ['part', 'user']
|
||||||
|
|
||||||
|
|
||||||
|
class PartParameter(models.Model):
|
||||||
|
""" A PartParameter provides key:value pairs for extra
|
||||||
|
parameters fields/values to be added to a Part.
|
||||||
|
This allows users to arbitrarily assign data fields to a Part
|
||||||
|
beyond the built-in attributes.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
part: Link to a Part object
|
||||||
|
name: The name (key) of the Parameter [string]
|
||||||
|
data: The data (value) of the Parameter [string]
|
||||||
|
"""
|
||||||
|
|
||||||
|
part = models.ForeignKey(Part, on_delete=models.CASCADE,
|
||||||
|
related_name='parameters',
|
||||||
|
help_text='Parent Part',
|
||||||
|
)
|
||||||
|
|
||||||
|
name = models.CharField(max_length=100, help_text='Parameter Name')
|
||||||
|
|
||||||
|
data = models.CharField(max_length=100, help_text='Parameter Value')
|
||||||
|
|
||||||
|
|
||||||
class BomItem(models.Model):
|
class BomItem(models.Model):
|
||||||
""" A BomItem links a part to its component items.
|
""" A BomItem links a part to its component items.
|
||||||
A part can have a BOM (bill of materials) which defines
|
A part can have a BOM (bill of materials) which defines
|
||||||
|
Loading…
x
Reference in New Issue
Block a user