added waiting time
This commit is contained in:
parent
40277f9b4f
commit
42faafef9f
@ -18,12 +18,13 @@ class ExternalRecipeForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Recipe
|
||||
fields = ('name', 'keywords', 'time', 'file_path', 'storage', 'file_uid')
|
||||
fields = ('name', 'keywords', 'working_time', 'waiting_time', 'file_path', 'storage', 'file_uid')
|
||||
|
||||
labels = {
|
||||
'name': _('Name'),
|
||||
'keywords': _('Keywords'),
|
||||
'time': _('Preparation time in minutes'),
|
||||
'working_time': _('Preparation time in minutes'),
|
||||
'waiting_time': _('Waiting time (cooking/baking) in minutes'),
|
||||
'file_path': _('Path'),
|
||||
'file_uid': _('Storage UID'),
|
||||
}
|
||||
@ -33,13 +34,14 @@ class ExternalRecipeForm(forms.ModelForm):
|
||||
class InternalRecipeForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Recipe
|
||||
fields = ('name', 'instructions', 'image', 'time', 'keywords')
|
||||
fields = ('name', 'instructions', 'image', 'working_time', 'waiting_time', 'keywords')
|
||||
|
||||
labels = {
|
||||
'name': _('Name'),
|
||||
'keywords': _('Keywords'),
|
||||
'instructions': _('Instructions'),
|
||||
'time': _('Preparation time in minutes'),
|
||||
'working_time': _('Preparation time in minutes'),
|
||||
'waiting_time': _('Waiting time (cooking/baking) in minutes'),
|
||||
}
|
||||
widgets = {'keywords': MultiSelectWidget}
|
||||
|
||||
|
23
cookbook/migrations/0007_auto_20191226_0852.py
Normal file
23
cookbook/migrations/0007_auto_20191226_0852.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.0.1 on 2019-12-26 07:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0006_recipe_image'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='recipe',
|
||||
old_name='time',
|
||||
new_name='working_time',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='recipe',
|
||||
name='waiting_time',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
@ -63,7 +63,8 @@ class Recipe(models.Model):
|
||||
file_path = models.CharField(max_length=512, default="")
|
||||
link = models.CharField(max_length=512, default="")
|
||||
keywords = models.ManyToManyField(Keyword, blank=True)
|
||||
time = models.IntegerField(default=0)
|
||||
working_time = models.IntegerField(default=0)
|
||||
waiting_time = models.IntegerField(default=0)
|
||||
internal = models.BooleanField(default=False)
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -28,24 +28,30 @@
|
||||
{% endif %}
|
||||
|
||||
{% if recipe.internal %}
|
||||
<small>{% trans 'by' %} {{ recipe.created_by.username }}</small><br/>
|
||||
<small>{% trans 'by' %} {{ recipe.created_by.username }}<br/></small>
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
<br/>
|
||||
|
||||
{% if recipe.all_tags %}
|
||||
{{ recipe.all_tags }}
|
||||
<br/>
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
{% if recipe.time and recipe.time != 0 %}
|
||||
<small>{% trans 'Preparation time ca.' %} {{ recipe.time }} min </small>
|
||||
{% if recipe.working_time and recipe.working_time != 0 %}
|
||||
<span class="badge badge-secondary">{% trans 'Preparation time ca.' %} {{ recipe.working_time }} min </span>
|
||||
{% endif %}
|
||||
|
||||
{% if recipe.waiting_time and recipe.waiting_time != 0 %}
|
||||
<span
|
||||
class="badge badge-secondary">{% trans 'Waiting time ca.' %} {{ recipe.waiting_time }} min </span>
|
||||
{% endif %}
|
||||
|
||||
{% if recipe.waiting_time and recipe.waiting_time != 0 or recipe.working_time and recipe.working_time != 0 %}
|
||||
<br/>
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
{% if ingredients %}
|
||||
<div class="col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2">
|
||||
@ -94,7 +100,8 @@
|
||||
{% endif %}
|
||||
{% if recipe.image %}
|
||||
<div class="col-md-6 order-md-2 col-sm-12 order-sm-1 col-12 order-1 " style="text-align: center">
|
||||
<img class="img img-fluid rounded" src="{{ recipe.image.url }}" style="max-height: 30vh;" alt="{% trans 'Recipe Image' %}">
|
||||
<img class="img img-fluid rounded" src="{{ recipe.image.url }}" style="max-height: 30vh;"
|
||||
alt="{% trans 'Recipe Image' %}">
|
||||
<br/>
|
||||
<br/>
|
||||
</div>
|
||||
|
@ -45,7 +45,8 @@ def internal_recipe_update(request, pk):
|
||||
recipe = recipe_instance
|
||||
recipe.name = form.cleaned_data['name']
|
||||
recipe.instructions = form.cleaned_data['instructions']
|
||||
recipe.time = form.cleaned_data['time']
|
||||
recipe.working_time = form.cleaned_data['working_time']
|
||||
recipe.waiting_time = form.cleaned_data['waiting_time']
|
||||
|
||||
if form.cleaned_data['image']:
|
||||
recipe.image = form.cleaned_data['image']
|
||||
|
Loading…
Reference in New Issue
Block a user