recipe description

This commit is contained in:
vabene1111 2021-01-13 13:26:48 +01:00
parent 97b5f64718
commit ddc484562b
6 changed files with 48 additions and 7 deletions

View File

@ -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)]),
),
]

View File

@ -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(

View File

@ -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'
)

View File

@ -83,6 +83,19 @@
</multiselect>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="id_description">
{% trans 'Description' %}
</label>
<textarea id="id_description" class="form-control" v-model="recipe.description" maxlength="512"></textarea>
</div>
</div>
<template v-if="recipe !== undefined">
<div class="row" v-if="recipe.nutrition" style="margin-top: 1vh">
<div class="col-md-12">

View File

@ -8,7 +8,7 @@
<div class="row">
<div class="col-12" style="text-align: center">
<i>Hier könnte ihre Rezeptbeschreibung stehen</i>
<i>{{ recipe.description }}</i>
</div>
</div>
@ -41,11 +41,13 @@
<div class="col col-md-4 col-10">
<table>
<tr>
<td >
<td>
<i class="fas fa-pizza-slice fa-2x text-primary"></i>
</td>
<td >
<input dir="rtl" style="border-width:0px;border:none; padding:0px; padding-left: 0.5vw; padding-right: 8px; max-width: 80px" value="1" maxlength="3"
<td>
<input dir="rtl"
style="border-width:0px;border:none; padding:0px; padding-left: 0.5vw; padding-right: 8px; max-width: 80px"
value="1" maxlength="3"
type="number" class="form-control form-control-lg" v-model.number="servings"/>
</td>
@ -79,7 +81,7 @@
<table class="table table-sm">
<!-- eslint-disable vue/no-v-for-template-key-on-child -->
<template v-for="s in recipe.steps">
<template v-for="i in s.ingredients" >
<template v-for="i in s.ingredients">
<Ingredient v-bind:ingredient="i" v-bind:servings="servings" :key="i.id"></Ingredient>
</template>
</template>

View File

@ -1 +1 @@
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.199fbcc22de2dbfbf840.hot-update.js","publicPath":"http://localhost:8080/recipe_view.199fbcc22de2dbfbf840.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.199fbcc22de2dbfbf840.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\components\\Step.vue\n 22:44 error Unexpected mutation of \"details_visible\" prop vue/no-mutating-props\n 93:22 error The \"details_visible\" property should be a constructor vue/require-prop-type-constructor\n\n✖ 2 problems (2 errors, 0 warnings)\n"}
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.19a3fb10aeaef2519f5d.hot-update.js","publicPath":"http://localhost:8080/recipe_view.19a3fb10aeaef2519f5d.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.19a3fb10aeaef2519f5d.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\components\\Step.vue\n 22:44 error Unexpected mutation of \"details_visible\" prop vue/no-mutating-props\n 93:22 error The \"details_visible\" property should be a constructor vue/require-prop-type-constructor\n\n✖ 2 problems (2 errors, 0 warnings)\n"}