1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Compare commits

..

2 Commits

9 changed files with 1850 additions and 473 deletions

View File

@ -0,0 +1,62 @@
from django.db import migrations
def create_14_mandatory_allergens(apps, schema_editor):
"""
There are 14 mandatory allergens, they are pre-injected
"""
Allergen = apps.get_model("food", "allergen")
Allergen.objects.get_or_create(
name="Gluten",
)
Allergen.objects.get_or_create(
name="Fruits à coques",
)
Allergen.objects.get_or_create(
name="Crustacés",
)
Allergen.objects.get_or_create(
name="Céléri",
)
Allergen.objects.get_or_create(
name="Oeufs",
)
Allergen.objects.get_or_create(
name="Moutarde",
)
Allergen.objects.get_or_create(
name="Poissons",
)
Allergen.objects.get_or_create(
name="Soja",
)
Allergen.objects.get_or_create(
name="Lait",
)
Allergen.objects.get_or_create(
name="Sulfites",
)
Allergen.objects.get_or_create(
name="Sésame",
)
Allergen.objects.get_or_create(
name="Lupin",
)
Allergen.objects.get_or_create(
name="Arachides",
)
Allergen.objects.get_or_create(
name="Mollusques",
)
class Migration(migrations.Migration):
dependencies = [
('food', '0002_transformedfood_shelf_life'),
]
operations = [
migrations.RunPython(create_14_mandatory_allergens),
]

View File

@ -11,17 +11,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
{{ title }} {{ title }}
</h3> </h3>
<div class="card-body"> <div class="card-body">
<p>name : {{ food.name }}</p> <p>{% trans 'Name' %} : {{ food.name }}</p>
<p>owner : {{ food.owner }}</p> <p>{% trans 'Owner' %} : {{ food.owner }}</p>
<p>arrival_date : {{ food.arrival_date }}</p> <p>{% trans 'Arrival date' %} : {{ food.arrival_date }}</p>
<p>expiry_date : {{ food.expiry_date }}</p> <p>{% trans 'Expiry date' %} : {{ food.expiry_date }}</p>
<p>allergens :</p> <p>{% trans 'Allergens' %} :</p>
<ul> <ul>
{% for allergen in food.allergens.iterator %} {% for allergen in food.allergens.iterator %}
<li>{{ allergen.name }}</li> <li>{{ allergen.name }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{% url "food:basic_update" pk=food.pk %}">Update</a> <a href="{% url "food:basic_update" pk=food.pk %}">{% trans 'Update' %}</a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -6,19 +6,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block content %} {% block content %}
<div class="card bg-white mb-3"> <div class="card bg-white mb-3">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
HTML not finished <br> HTML not finished <br>
{{ title }} {{ title }}
</h3> </h3>
<div class="card-body"> <div class="card-body">
<p>qrcode : {{ qrcode.qr_code_number }}</p> <p>{% trans 'QR-code' %} : {{ qrcode.qr_code_number }}</p>
<p>name : {{ qrcode.food_container.name }}</p> <p>{% trans 'Name' %} : {{ qrcode.food_container.name }}</p>
{% if qrcode.food_container.polymorphic_ctype.name == 'Basic food' %} {% if qrcode.food_container.polymorphic_ctype.name == 'Basic food' %}
<a href="{% url "food:basic_update" pk=qrcode.food_container.pk %}">Update</a> <a href="{% url "food:basic_update" pk=qrcode.food_container.pk %}">{% trans 'Update' %}</a>
{% else %} {% else %}
<a href="{% url "food:transformed_update" pk=qrcode.food_container.pk %}">Update</a> <a href="{% url "food:transformed_update" pk=qrcode.food_container.pk %}">{% trans 'Update' %}</a>
{% endif %} {% endif %}
<a href="{% url "food:add_ingredient" pk=qrcode.food_container.pk %}">Add the ingrdient</a> <a href="{% url "food:add_ingredient" pk=qrcode.food_container.pk %}">{% trans 'Add the ingredient' %}</a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -6,28 +6,28 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block content %} {% block content %}
<div class="card bg-white mb-3"> <div class="card bg-white mb-3">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
HTML not finished <br> HTML not finished <br>
{{ title }} {{ title }}
</h3> </h3>
<div class="card-body"> <div class="card-body">
<p>name : {{ food.name }}</p> <p>{% trans 'Name' %} : {{ food.name }}</p>
<p>owner : {{ food.owner }}</p> <p>{% trans 'Owner' %} : {{ food.owner }}</p>
<p>creation_date : {{ food.creation_date }}</p> <p>{% trans 'Creation date' %} : {{ food.creation_date }}</p>
<p>expiry_date : {{ food.expiry_date }}</p> <p>{% trans 'Expiry date' %} : {{ food.expiry_date }}</p>
<p>allergens :</p> <p>{% trans 'Allergens' %} :</p>
<ul> <ul>
{% for allergen in food.allergens.iterator %} {% for allergen in food.allergens.iterator %}
<li>{{ allergen.name }}</li> <li>{{ allergen.name }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<p>ingredients :</p> <p>{% trans 'Ingredients' %} :</p>
<ul> <ul>
{% for ingredient in food.ingredient.iterator %} {% for ingredient in food.ingredient.iterator %}
<li><a href="{% url "food:food_view" pk=ingredient.pk %}">{{ ingredient.name }}</a></li> <li><a href="{% url "food:food_view" pk=ingredient.pk %}">{{ ingredient.name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{% url "food:transformed_update" pk=food.pk %}">Update</a> <a href="{% url "food:transformed_update" pk=food.pk %}">{% trans 'Update' %}</a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -7,18 +7,18 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block content %} {% block content %}
<div class="card bg-light mb-3"> <div class="card bg-light mb-3">
<div class="card-footer"> <div class="card-footer">
<a class="btn btn-sm btn-success" href="{% url 'food:transformed_create' %}" data-turbolinks="false"> <a class="btn btn-sm btn-success" href="{% url 'food:transformed_create' %}" data-turbolinks="false">
New transformed food {% trans 'New meal' %}
</a> </a>
</div> </div>
<h3 class="card-header text-center"> <h3 class="card-header text-center">
In preparation {% trans 'In preparation' %}
</h3> </h3>
{% render_table table %} {% render_table table %}
<h3 class="card-header text-center"> <h3 class="card-header text-center">
Open {% trans 'Free' %}
</h3> </h3>
{% render_table open_table %} {% render_table open_table %}
</div> </div>
{% endblock %} {% endblock %}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -66,14 +66,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-coffee"></i> {% trans 'Consumptions' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-coffee"></i> {% trans 'Consumptions' %}</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item"> {% if request.user.is_authenticated %}
{% url 'food:food_list' as url %} <li class="nav-item">
<a data-turbolinks="false" class="nav-link" href="{{ url }}">Food</a> {% url 'food:food_list' as url %}
</li> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-cutlery"></i>_{% trans 'Food' %}</a>
</li>
{% endif %}
{% if user.is_authenticated and user|is_member:"Kfet" %} {% if user.is_authenticated and user|is_member:"Kfet" %}
<li class="nav-item"> <li class="nav-item">
{% url 'note:transfer' as url %} {% url 'note:transfer' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-exchange"></i> {% trans 'Transfer' %} </a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-exchange"></i> {% trans 'Transfer' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "auth.user"|model_list_length >= 2 %} {% if "auth.user"|model_list_length >= 2 %}