From ddc484562b4b3290d3de1789b50abe559a0f689c Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 13 Jan 2021 13:26:48 +0100 Subject: [PATCH] recipe description --- .../migrations/0097_auto_20210113_1315.py | 25 +++++++++++++++++++ cookbook/models.py | 1 + cookbook/serializer.py | 2 +- .../templates/forms/edit_internal_recipe.html | 13 ++++++++++ vue/src/apps/RecipeView/RecipeView.vue | 12 +++++---- vue/webpack-stats.json | 2 +- 6 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 cookbook/migrations/0097_auto_20210113_1315.py diff --git a/cookbook/migrations/0097_auto_20210113_1315.py b/cookbook/migrations/0097_auto_20210113_1315.py new file mode 100644 index 000000000..97861c87a --- /dev/null +++ b/cookbook/migrations/0097_auto_20210113_1315.py @@ -0,0 +1,25 @@ +# Generated by Django 3.1.5 on 2021-01-13 12:15 + +import datetime +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cookbook', '0096_auto_20210109_2044'), + ] + + operations = [ + migrations.AddField( + model_name='recipe', + name='description', + field=models.CharField(blank=True, max_length=512, null=True), + ), + migrations.AlterField( + model_name='food', + name='name', + field=models.CharField(max_length=128, unique=True, validators=[django.core.validators.MinLengthValidator(1)]), + ), + ] diff --git a/cookbook/models.py b/cookbook/models.py index 7f5ae9749..4387d3ad1 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -248,6 +248,7 @@ class NutritionInformation(models.Model): class Recipe(models.Model): name = models.CharField(max_length=128) + description = models.CharField(max_length=512, blank=True, null=True) servings = models.IntegerField(default=1) image = models.ImageField(upload_to='recipes/', blank=True, null=True) storage = models.ForeignKey( diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 32fec2312..7f39e56db 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -189,7 +189,7 @@ class RecipeSerializer(WritableNestedModelSerializer): class Meta: model = Recipe fields = ( - 'id', 'name', 'image', 'keywords', 'steps', 'working_time', + 'id', 'name', 'description', 'image', 'keywords', 'steps', 'working_time', 'waiting_time', 'created_by', 'created_at', 'updated_at', 'internal', 'nutrition', 'servings', 'file_path' ) diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html index 2f7f4307c..66b23038e 100644 --- a/cookbook/templates/forms/edit_internal_recipe.html +++ b/cookbook/templates/forms/edit_internal_recipe.html @@ -83,6 +83,19 @@ + +
+
+ + + +
+ +
+ +