mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
added waiting time
This commit is contained in:
@@ -18,12 +18,13 @@ class ExternalRecipeForm(forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Recipe
|
model = Recipe
|
||||||
fields = ('name', 'keywords', 'time', 'file_path', 'storage', 'file_uid')
|
fields = ('name', 'keywords', 'working_time', 'waiting_time', 'file_path', 'storage', 'file_uid')
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
'name': _('Name'),
|
'name': _('Name'),
|
||||||
'keywords': _('Keywords'),
|
'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_path': _('Path'),
|
||||||
'file_uid': _('Storage UID'),
|
'file_uid': _('Storage UID'),
|
||||||
}
|
}
|
||||||
@@ -33,13 +34,14 @@ class ExternalRecipeForm(forms.ModelForm):
|
|||||||
class InternalRecipeForm(forms.ModelForm):
|
class InternalRecipeForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Recipe
|
model = Recipe
|
||||||
fields = ('name', 'instructions', 'image', 'time', 'keywords')
|
fields = ('name', 'instructions', 'image', 'working_time', 'waiting_time', 'keywords')
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
'name': _('Name'),
|
'name': _('Name'),
|
||||||
'keywords': _('Keywords'),
|
'keywords': _('Keywords'),
|
||||||
'instructions': _('Instructions'),
|
'instructions': _('Instructions'),
|
||||||
'time': _('Preparation time in minutes'),
|
'working_time': _('Preparation time in minutes'),
|
||||||
|
'waiting_time': _('Waiting time (cooking/baking) in minutes'),
|
||||||
}
|
}
|
||||||
widgets = {'keywords': MultiSelectWidget}
|
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="")
|
file_path = models.CharField(max_length=512, default="")
|
||||||
link = models.CharField(max_length=512, default="")
|
link = models.CharField(max_length=512, default="")
|
||||||
keywords = models.ManyToManyField(Keyword, blank=True)
|
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)
|
internal = models.BooleanField(default=False)
|
||||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|||||||
@@ -28,24 +28,30 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if recipe.internal %}
|
{% if recipe.internal %}
|
||||||
<small>{% trans 'by' %} {{ recipe.created_by.username }}</small><br/>
|
<small>{% trans 'by' %} {{ recipe.created_by.username }}<br/></small>
|
||||||
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
{% if recipe.all_tags %}
|
{% if recipe.all_tags %}
|
||||||
{{ recipe.all_tags }}
|
{{ recipe.all_tags }}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if recipe.time and recipe.time != 0 %}
|
{% if recipe.working_time and recipe.working_time != 0 %}
|
||||||
<small>{% trans 'Preparation time ca.' %} {{ recipe.time }} min </small>
|
<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/>
|
||||||
<br/>
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if ingredients %}
|
{% if ingredients %}
|
||||||
<div class="col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2">
|
<div class="col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2">
|
||||||
@@ -94,7 +100,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if recipe.image %}
|
{% 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">
|
<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/>
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ def internal_recipe_update(request, pk):
|
|||||||
recipe = recipe_instance
|
recipe = recipe_instance
|
||||||
recipe.name = form.cleaned_data['name']
|
recipe.name = form.cleaned_data['name']
|
||||||
recipe.instructions = form.cleaned_data['instructions']
|
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']:
|
if form.cleaned_data['image']:
|
||||||
recipe.image = form.cleaned_data['image']
|
recipe.image = form.cleaned_data['image']
|
||||||
|
|||||||
Reference in New Issue
Block a user