mirror of https://gitlab.crans.org/bde/nk20
Compare commits
2 Commits
a7e87ea639
...
b2b1f03b46
Author | SHA1 | Date |
---|---|---|
quark | b2b1f03b46 | |
quark | 1c5ed2bd3f |
|
@ -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),
|
||||
]
|
||||
|
||||
|
|
@ -11,17 +11,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p>name : {{ food.name }}</p>
|
||||
<p>owner : {{ food.owner }}</p>
|
||||
<p>arrival_date : {{ food.arrival_date }}</p>
|
||||
<p>expiry_date : {{ food.expiry_date }}</p>
|
||||
<p>allergens :</p>
|
||||
<p>{% trans 'Name' %} : {{ food.name }}</p>
|
||||
<p>{% trans 'Owner' %} : {{ food.owner }}</p>
|
||||
<p>{% trans 'Arrival date' %} : {{ food.arrival_date }}</p>
|
||||
<p>{% trans 'Expiry date' %} : {{ food.expiry_date }}</p>
|
||||
<p>{% trans 'Allergens' %} :</p>
|
||||
<ul>
|
||||
{% for allergen in food.allergens.iterator %}
|
||||
<li>{{ allergen.name }}</li>
|
||||
{% endfor %}
|
||||
</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>
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,19 +6,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
|
||||
{% block content %}
|
||||
<div class="card bg-white mb-3">
|
||||
<h3 class="card-header text-center">
|
||||
HTML not finished <br>
|
||||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p>qrcode : {{ qrcode.qr_code_number }}</p>
|
||||
<p>name : {{ qrcode.food_container.name }}</p>
|
||||
{% if qrcode.food_container.polymorphic_ctype.name == 'Basic food' %}
|
||||
<a href="{% url "food:basic_update" pk=qrcode.food_container.pk %}">Update</a>
|
||||
{% else %}
|
||||
<a href="{% url "food:transformed_update" pk=qrcode.food_container.pk %}">Update</a>
|
||||
{% endif %}
|
||||
<a href="{% url "food:add_ingredient" pk=qrcode.food_container.pk %}">Add the ingrdient</a>
|
||||
</div>
|
||||
<h3 class="card-header text-center">
|
||||
HTML not finished <br>
|
||||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p>{% trans 'QR-code' %} : {{ qrcode.qr_code_number }}</p>
|
||||
<p>{% trans 'Name' %} : {{ qrcode.food_container.name }}</p>
|
||||
{% if qrcode.food_container.polymorphic_ctype.name == 'Basic food' %}
|
||||
<a href="{% url "food:basic_update" pk=qrcode.food_container.pk %}">{% trans 'Update' %}</a>
|
||||
{% else %}
|
||||
<a href="{% url "food:transformed_update" pk=qrcode.food_container.pk %}">{% trans 'Update' %}</a>
|
||||
{% endif %}
|
||||
<a href="{% url "food:add_ingredient" pk=qrcode.food_container.pk %}">{% trans 'Add the ingredient' %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,28 +6,28 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
|
||||
{% block content %}
|
||||
<div class="card bg-white mb-3">
|
||||
<h3 class="card-header text-center">
|
||||
HTML not finished <br>
|
||||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p>name : {{ food.name }}</p>
|
||||
<p>owner : {{ food.owner }}</p>
|
||||
<p>creation_date : {{ food.creation_date }}</p>
|
||||
<p>expiry_date : {{ food.expiry_date }}</p>
|
||||
<p>allergens :</p>
|
||||
<ul>
|
||||
{% for allergen in food.allergens.iterator %}
|
||||
<li>{{ allergen.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p>ingredients :</p>
|
||||
<ul>
|
||||
{% for ingredient in food.ingredient.iterator %}
|
||||
<li><a href="{% url "food:food_view" pk=ingredient.pk %}">{{ ingredient.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{% url "food:transformed_update" pk=food.pk %}">Update</a>
|
||||
</div>
|
||||
<h3 class="card-header text-center">
|
||||
HTML not finished <br>
|
||||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<p>{% trans 'Name' %} : {{ food.name }}</p>
|
||||
<p>{% trans 'Owner' %} : {{ food.owner }}</p>
|
||||
<p>{% trans 'Creation date' %} : {{ food.creation_date }}</p>
|
||||
<p>{% trans 'Expiry date' %} : {{ food.expiry_date }}</p>
|
||||
<p>{% trans 'Allergens' %} :</p>
|
||||
<ul>
|
||||
{% for allergen in food.allergens.iterator %}
|
||||
<li>{{ allergen.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p>{% trans 'Ingredients' %} :</p>
|
||||
<ul>
|
||||
{% for ingredient in food.ingredient.iterator %}
|
||||
<li><a href="{% url "food:food_view" pk=ingredient.pk %}">{{ ingredient.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{% url "food:transformed_update" pk=food.pk %}">{% trans 'Update' %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,18 +7,18 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
|
||||
{% block content %}
|
||||
<div class="card bg-light mb-3">
|
||||
<div class="card-footer">
|
||||
<a class="btn btn-sm btn-success" href="{% url 'food:transformed_create' %}" data-turbolinks="false">
|
||||
New transformed food
|
||||
</a>
|
||||
</div>
|
||||
<h3 class="card-header text-center">
|
||||
In preparation
|
||||
</h3>
|
||||
{% render_table table %}
|
||||
<h3 class="card-header text-center">
|
||||
Open
|
||||
</h3>
|
||||
{% render_table open_table %}
|
||||
<div class="card-footer">
|
||||
<a class="btn btn-sm btn-success" href="{% url 'food:transformed_create' %}" data-turbolinks="false">
|
||||
{% trans 'New meal' %}
|
||||
</a>
|
||||
</div>
|
||||
<h3 class="card-header text-center">
|
||||
{% trans 'In preparation' %}
|
||||
</h3>
|
||||
{% render_table table %}
|
||||
<h3 class="card-header text-center">
|
||||
{% trans 'Free' %}
|
||||
</h3>
|
||||
{% render_table open_table %}
|
||||
</div>
|
||||
{% 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
|
@ -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>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
{% url 'food:food_list' as url %}
|
||||
<a data-turbolinks="false" class="nav-link" href="{{ url }}">Food</a>
|
||||
</li>
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
{% url 'food:food_list' as url %}
|
||||
<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" %}
|
||||
<li class="nav-item">
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% if "auth.user"|model_list_length >= 2 %}
|
||||
|
|
Loading…
Reference in New Issue