completed all products models

This commit is contained in:
2024-03-03 03:57:39 +03:00
parent 06c8cf4246
commit 1ed28fdc7d
2 changed files with 35 additions and 3 deletions
+5 -2
View File
@@ -4,7 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="03e03f4d-45bc-4bed-b39e-371f1d24898e" name="Changes" comment="remove unnecessary hooks" />
<list default="true" id="03e03f4d-45bc-4bed-b39e-371f1d24898e" name="Changes" comment="remove unnecessary hooks">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/products/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/products/models.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -86,7 +89,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1709421008833</updated>
<workItem from="1709421138204" duration="5142000" />
<workItem from="1709421138204" duration="6199000" />
</task>
<task id="LOCAL-00001" summary="Initial commit">
<option name="closed" value="true" />
+30 -1
View File
@@ -1,3 +1,32 @@
from django.db import models
# Create your models here.
class Brand(models.Model):
name = models.CharField(max_length=100)
description = models.TextField(blank=True)
def __str__(self):
return f"{self.name}"
class Supplier(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField()
phone = models.CharField(max_length=20)
def __str__(self):
return f"{self.name}"
class Product(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
sku = models.CharField(max_length=50)
price = models.DecimalField(max_digits=10, decimal_places=2)
quantity = models.IntegerField(default=0)
barcode = models.CharField(max_length=100, blank=True, null=True)
brand = models.ForeignKey(Brand, models.DO_NOTHING)
supplier = models.ForeignKey(Supplier, models.DO_NOTHING)
def __str__(self):
return f"{self.name}"