From 4ef1e4fc7822e22e2142542839dd08d08c8c4744 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 4 May 2019 17:00:33 +1000 Subject: [PATCH] Explicitly mark some CharField as non blank --- InvenTree/InvenTree/models.py | 11 +++++++++-- InvenTree/build/models.py | 5 ++++- InvenTree/company/models.py | 2 +- InvenTree/stock/models.py | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index 61fb50831b..c9c9e2966b 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -23,9 +23,16 @@ class InvenTreeTree(models.Model): abstract = True unique_together = ('name', 'parent') - name = models.CharField(max_length=100, unique=True) + name = models.CharField( + blank=False, + max_length=100, + unique=True + ) - description = models.CharField(max_length=250) + description = models.CharField( + blank=False, + max_length=250 + ) # When a category is deleted, graft the children onto its parent parent = models.ForeignKey('self', diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index a25c99f37d..7175a18650 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -87,7 +87,10 @@ class Build(models.Model): limit_choices_to={'buildable': True}, ) - title = models.CharField(max_length=100, help_text='Brief description of the build') + title = models.CharField( + blank=False, + max_length=100, + help_text='Brief description of the build') quantity = models.PositiveIntegerField( default=1, diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index dcee37959d..1d119ddf51 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -42,7 +42,7 @@ class Company(models.Model): It may be a supplier or a customer (or both). """ - name = models.CharField(max_length=100, unique=True, + name = models.CharField(max_length=100, blank=False, unique=True, help_text='Company name') description = models.CharField(max_length=500) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 7cdc45b7bc..4643ae904c 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -390,7 +390,7 @@ class StockItemTracking(models.Model): date = models.DateTimeField(auto_now_add=True, editable=False) # Short-form title for this tracking entry - title = models.CharField(max_length=250) + title = models.CharField(blank=False, max_length=250) # Optional longer description notes = models.TextField(blank=True)