mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
wip supermarket categories
This commit is contained in:
@@ -144,14 +144,6 @@ class Sync(models.Model):
|
||||
return self.path
|
||||
|
||||
|
||||
class Supermarket(models.Model):
|
||||
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
|
||||
description = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class SupermarketCategory(models.Model):
|
||||
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
|
||||
description = models.TextField(blank=True, null=True)
|
||||
@@ -160,6 +152,21 @@ class SupermarketCategory(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
class Supermarket(models.Model):
|
||||
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
|
||||
description = models.TextField(blank=True, null=True)
|
||||
categories = models.ManyToManyField(SupermarketCategory, through='SupermarketCategoryRelation')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class SupermarketCategoryRelation(models.Model):
|
||||
supermarket = models.ForeignKey(Supermarket, on_delete=models.CASCADE)
|
||||
category = models.ForeignKey(SupermarketCategory, on_delete=models.CASCADE)
|
||||
order = models.IntegerField(default=0)
|
||||
|
||||
|
||||
class SyncLog(models.Model):
|
||||
sync = models.ForeignKey(Sync, on_delete=models.CASCADE)
|
||||
status = models.CharField(max_length=32)
|
||||
|
||||
Reference in New Issue
Block a user