Renamed StoredIngredients to StoredIngredient

This commit is contained in:
2020-02-19 13:21:06 +01:00
parent 8879d7c5aa
commit f4506d8a7e
2 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ class Migration(migrations.Migration):
], ],
), ),
migrations.CreateModel( migrations.CreateModel(
name='StoredIngredients', name='StoredIngredient',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.PositiveIntegerField(help_text='Please specify the stored amount of the ingredient', verbose_name='Amount')), ('amount', models.PositiveIntegerField(help_text='Please specify the stored amount of the ingredient', verbose_name='Amount')),
@ -122,7 +122,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='pantry', model_name='pantry',
name='ingredients', name='ingredients',
field=models.ManyToManyField(through='food_planner.StoredIngredients', to='food_planner.Ingredient'), field=models.ManyToManyField(through='food_planner.StoredIngredient', to='food_planner.Ingredient'),
), ),
migrations.AddField( migrations.AddField(
model_name='pantry', model_name='pantry',

View File

@ -136,7 +136,7 @@ class Product(models.Model):
class Pantry(models.Model): class Pantry(models.Model):
owner = models.ForeignKey(User, models.CASCADE) owner = models.ForeignKey(User, models.CASCADE)
ingredients = models.ManyToManyField(Ingredient, through='StoredIngredients') ingredients = models.ManyToManyField(Ingredient, through='StoredIngredient')
def __str__(self): def __str__(self):
return format_lazy('Pantry of {firstName} {lastName}', return format_lazy('Pantry of {firstName} {lastName}',
@ -144,7 +144,7 @@ class Pantry(models.Model):
lastName=self.owner.last_name) lastName=self.owner.last_name)
class StoredIngredients(models.Model): class StoredIngredient(models.Model):
pantry = models.ForeignKey(Pantry, models.CASCADE) pantry = models.ForeignKey(Pantry, models.CASCADE)
ingredient = models.ForeignKey(Ingredient, models.CASCADE) ingredient = models.ForeignKey(Ingredient, models.CASCADE)
amount = models.PositiveIntegerField(_('Amount'), amount = models.PositiveIntegerField(_('Amount'),