make customer name required field.

This commit is contained in:
2024-08-17 09:48:36 -05:00
parent 398f7f2c36
commit 8f611a523b
3 changed files with 31 additions and 3 deletions

View File

@@ -6,8 +6,11 @@ from decimal import Decimal
class Customer(models.Model):
name = models.CharField(max_length=100)
address = models.CharField(max_length=100)
name = models.CharField(max_length=100, default=None, null=False, blank=False)
address = models.CharField(max_length=100, null=True, blank=True)
def __str__(self):
return self.name
class MeasuringUnits(models.TextChoices):
@@ -53,7 +56,7 @@ class Sale(models.Model):
class SaleLine(models.Model):
sale = models.ForeignKey(Sale, on_delete=models.CASCADE)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
product = models.ForeignKey(Product, null=False, blank=False, on_delete=models.CASCADE)
quantity = models.IntegerField(null=True)
unit_price = models.DecimalField(max_digits=9, decimal_places=2)
description = models.CharField(max_length=255, null=True, blank=True)