From c9980b0bd13ed97e8dae6180fe64a940c98ad939 Mon Sep 17 00:00:00 2001 From: quark Date: Tue, 21 May 2024 11:21:13 +0200 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20de=20l'interface=20admin=20temp?= =?UTF-8?q?oraire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/food/admin.py | 28 ++++++++++++++++++- .../migrations/0002_auto_20240521_1103.py | 19 +++++++++++++ .../migrations/0003_auto_20240521_1110.py | 19 +++++++++++++ apps/food/models.py | 2 ++ apps/food/urls.py | 7 +++++ apps/food/views.py | 4 ++- note_kfet/urls.py | 1 + 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 apps/food/migrations/0002_auto_20240521_1103.py create mode 100644 apps/food/migrations/0003_auto_20240521_1110.py create mode 100644 apps/food/urls.py diff --git a/apps/food/admin.py b/apps/food/admin.py index 8c38f3f3..820036c3 100644 --- a/apps/food/admin.py +++ b/apps/food/admin.py @@ -1,3 +1,29 @@ from django.contrib import admin +from note_kfet.admin import admin_site -# Register your models here. +from .models import QR_code, Basic_food, Transformed_food, Allergen + + +@admin.register(QR_code, site = admin_site) +class QR_codeAdmin(admin.ModelAdmin): + """ + TEMPORARY + """ + +@admin.register(Basic_food, site = admin_site) +class Basic_foodAdmin(admin.ModelAdmin): + """ + TEMPORARY + """ + +@admin.register(Transformed_food, site = admin_site) +class Transformed_foodAdmin(admin.ModelAdmin): + """ + TEMPORARY + """ + +@admin.register(Allergen, site = admin_site) +class AllergenAdmin(admin.ModelAdmin): + """ + TEMPORARY + """ diff --git a/apps/food/migrations/0002_auto_20240521_1103.py b/apps/food/migrations/0002_auto_20240521_1103.py new file mode 100644 index 00000000..6bdb8677 --- /dev/null +++ b/apps/food/migrations/0002_auto_20240521_1103.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.28 on 2024-05-21 09:03 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('food', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='transformed_food', + name='transformed_ingredient', + field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Transformed_food', verbose_name='transformed ingredient'), + ), + ] diff --git a/apps/food/migrations/0003_auto_20240521_1110.py b/apps/food/migrations/0003_auto_20240521_1110.py new file mode 100644 index 00000000..9f92f534 --- /dev/null +++ b/apps/food/migrations/0003_auto_20240521_1110.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.28 on 2024-05-21 09:10 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('food', '0002_auto_20240521_1103'), + ] + + operations = [ + migrations.AlterField( + model_name='transformed_food', + name='transformed_ingredient', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Transformed_food', verbose_name='transformed ingredient'), + ), + ] diff --git a/apps/food/models.py b/apps/food/models.py index acaa43f8..5347abc5 100644 --- a/apps/food/models.py +++ b/apps/food/models.py @@ -211,6 +211,8 @@ class Transformed_food(models.Model): transformed_ingredient = models.ForeignKey( "self", on_delete = models.CASCADE, + blank = True, + null = True, related_name = '+', verbose_name = _('transformed ingredient'), ) diff --git a/apps/food/urls.py b/apps/food/urls.py new file mode 100644 index 00000000..2fcca0db --- /dev/null +++ b/apps/food/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index') +] diff --git a/apps/food/views.py b/apps/food/views.py index 91ea44a2..c4cfa086 100644 --- a/apps/food/views.py +++ b/apps/food/views.py @@ -1,3 +1,5 @@ from django.shortcuts import render +from django.http import HttpResponse -# Create your views here. +def index(request): + return HttpResponse('test') diff --git a/note_kfet/urls.py b/note_kfet/urls.py index d222c239..01bec0ba 100644 --- a/note_kfet/urls.py +++ b/note_kfet/urls.py @@ -21,6 +21,7 @@ urlpatterns = [ path('activity/', include('activity.urls')), path('treasury/', include('treasury.urls')), path('wei/', include('wei.urls')), + path('food/',include('food.urls')), # Include Django Contrib and Core routers path('i18n/', include('django.conf.urls.i18n')),