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">