From 48d1b8d95235222d6257bc4ece78117f4b44d7c7 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 18 Nov 2019 13:28:31 +0100 Subject: [PATCH] changed ingredient field typ --- .../migrations/0013_auto_20191118_1328.py | 21 +++++++++++++++++++ cookbook/models.py | 6 +----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 cookbook/migrations/0013_auto_20191118_1328.py diff --git a/cookbook/migrations/0013_auto_20191118_1328.py b/cookbook/migrations/0013_auto_20191118_1328.py new file mode 100644 index 000000000..00c6c52ae --- /dev/null +++ b/cookbook/migrations/0013_auto_20191118_1328.py @@ -0,0 +1,21 @@ +# Generated by Django 2.2.7 on 2019-11-18 12:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cookbook', '0012_auto_20191118_1251'), + ] + + operations = [ + migrations.AlterField( + model_name='recipeingredients', + name='ingredient', + field=models.CharField(max_length=128), + ), + migrations.DeleteModel( + name='Ingredients', + ), + ] diff --git a/cookbook/models.py b/cookbook/models.py index e2b04c583..b2a991328 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -49,10 +49,6 @@ class Keyword(models.Model): return "{0} {1}".format(self.icon, self.name) -class Ingredients(models.Model): - name = models.CharField(max_length=128) - - class Recipe(models.Model): name = models.CharField(max_length=128) instructions = models.TextField(blank=True) @@ -79,7 +75,7 @@ class RecipeIngredients(models.Model): recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE) unit = models.CharField(max_length=128) amount = models.DecimalField(default=0, decimal_places=2, max_digits=16) - ingredient = models.ForeignKey(Ingredients, models.PROTECT) + ingredient = models.CharField(max_length=128) class Comment(models.Model):