Merge pull request #953 from SchrodingersGat/part-import-fix

Part: Alter model fields to fix data import issues
This commit is contained in:
Oliver 2020-09-03 00:18:26 +10:00 committed by GitHub
commit 11b751323e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 6 deletions

View File

@ -0,0 +1,48 @@
# Generated by Django 3.0.7 on 2020-09-02 14:04
import InvenTree.fields
import InvenTree.validators
import markdownx
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0047_auto_20200808_0715'),
]
operations = [
migrations.AlterField(
model_name='part',
name='IPN',
field=models.CharField(blank=True, help_text='Internal Part Number', max_length=100, null=True, validators=[InvenTree.validators.validate_part_ipn]),
),
migrations.AlterField(
model_name='part',
name='keywords',
field=models.CharField(blank=True, help_text='Part keywords to improve visibility in search results', max_length=250, null=True),
),
migrations.AlterField(
model_name='part',
name='link',
field=InvenTree.fields.InvenTreeURLField(blank=True, help_text='Link to extenal URL', null=True),
),
migrations.AlterField(
model_name='part',
name='revision',
field=models.CharField(blank=True, help_text='Part revision or version number', max_length=100, null=True),
),
migrations.AlterField(
model_name='part',
name='notes',
field=markdownx.models.MarkdownxField(blank=True, help_text='Part notes - supports Markdown formatting', null=True),
),
migrations.AlterField(
model_name='part',
name='units',
field=models.CharField(blank=True, default='', help_text='Stock keeping units for this part', max_length=20, null=True),
),
]

View File

@ -497,18 +497,18 @@ class Part(MPTTModel):
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')) keywords = models.CharField(max_length=250, blank=True, null=True, help_text=_('Part keywords to improve visibility in search results'))
category = TreeForeignKey(PartCategory, related_name='parts', category = TreeForeignKey(PartCategory, related_name='parts',
null=True, blank=True, null=True, blank=True,
on_delete=models.DO_NOTHING, on_delete=models.DO_NOTHING,
help_text=_('Part category')) help_text=_('Part category'))
IPN = models.CharField(max_length=100, blank=True, help_text=_('Internal Part Number'), validators=[validators.validate_part_ipn]) IPN = models.CharField(max_length=100, blank=True, null=True, help_text=_('Internal Part Number'), validators=[validators.validate_part_ipn])
revision = models.CharField(max_length=100, blank=True, help_text=_('Part revision or version number')) revision = models.CharField(max_length=100, blank=True, null=True, help_text=_('Part revision or version number'))
link = InvenTreeURLField(blank=True, help_text=_('Link to extenal URL')) link = InvenTreeURLField(blank=True, null=True, help_text=_('Link to extenal URL'))
image = StdImageField( image = StdImageField(
upload_to=rename_part_image, upload_to=rename_part_image,
@ -569,7 +569,7 @@ class Part(MPTTModel):
minimum_stock = models.PositiveIntegerField(default=0, validators=[MinValueValidator(0)], help_text=_('Minimum allowed stock level')) minimum_stock = models.PositiveIntegerField(default=0, validators=[MinValueValidator(0)], help_text=_('Minimum allowed stock level'))
units = models.CharField(max_length=20, default="", blank=True, help_text=_('Stock keeping units for this part')) units = models.CharField(max_length=20, default="", blank=True, null=True, help_text=_('Stock keeping units for this part'))
assembly = models.BooleanField(default=False, verbose_name='Assembly', help_text=_('Can this part be built from other parts?')) assembly = models.BooleanField(default=False, verbose_name='Assembly', help_text=_('Can this part be built from other parts?'))
@ -585,7 +585,7 @@ class Part(MPTTModel):
virtual = models.BooleanField(default=False, help_text=_('Is this a virtual part, such as a software product or license?')) virtual = models.BooleanField(default=False, help_text=_('Is this a virtual part, such as a software product or license?'))
notes = MarkdownxField(blank=True, help_text=_('Part notes - supports Markdown formatting')) notes = MarkdownxField(blank=True, null=True, help_text=_('Part notes - supports Markdown formatting'))
bom_checksum = models.CharField(max_length=128, blank=True, help_text=_('Stored BOM checksum')) bom_checksum = models.CharField(max_length=128, blank=True, help_text=_('Stored BOM checksum'))