diff --git a/.gitignore b/.gitignore
index 70b6bfe..4c9e788 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
__pycache__
db.sqlite3
run_dev.sh
+**/migrations/
diff --git a/cookAssistant/urls.py b/cookAssistant/urls.py
index 3269c04..8711c8c 100644
--- a/cookAssistant/urls.py
+++ b/cookAssistant/urls.py
@@ -1,46 +1,49 @@
-"""cookAssistant URL Configuration
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/2.2/topics/http/urls/
-Examples:
-Function views
- 1. Add an import: from my_app import views
- 2. Add a URL to urlpatterns: path('', views.home, name='home')
-Class-based views
- 1. Add an import: from other_app.views import Home
- 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
-Including another URLconf
- 1. Import the include() function: from django.urls import include, path
- 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
-"""
-from django.contrib import admin
-from django.urls import path, include
-from django.views.generic import TemplateView
-
-from recipe_book import views
-from rest_framework_nested import routers
-
-router = routers.DefaultRouter()
-router.register(r'recips', views.RecipesViewSet)
-router.register(r'ingdts', views.IngredientViewSet)
-
-amounts_router = routers.NestedDefaultRouter(
- router, r'recips', lookup="recipe"
-)
-amounts_router.register(
- r'amounts', views.IngredientWAmountViewSet,
- base_name="recipe-ingdt-amounts"
-)
-
-
-urlpatterns = [
- path('admin/', admin.site.urls),
- path('api/', include(router.urls)),
- path('api/', include(amounts_router.urls)),
- path('',
- TemplateView.as_view(
- template_name="application.html"
- ),
- name="app"
- ),
-]
+"""cookAssistant URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/2.2/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+from django.views.generic import TemplateView
+
+from recipe_book import views
+from planning import views as planning_views
+from rest_framework_nested import routers
+
+router = routers.DefaultRouter()
+router.register(r'recips', views.RecipesViewSet)
+router.register(r'ingdts', views.IngredientViewSet)
+
+amounts_router = routers.NestedDefaultRouter(
+ router, r'recips', lookup="recipe"
+)
+amounts_router.register(
+ r'amounts', views.IngredientWAmountViewSet,
+ base_name="recipe-ingdt-amounts"
+)
+
+router.register(r'planning', planning_views.MealViewSet)
+
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+ path('api/', include(router.urls)),
+ path('api/', include(amounts_router.urls)),
+ path('',
+ TemplateView.as_view(
+ template_name="application.html"
+ ),
+ name="app"
+ ),
+]
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 5a9cfb6..6cd0bbf 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -1,14 +1,7 @@
-
+
-
-
- CookAssistant
-
-
-
-
-
+
@@ -47,9 +40,7 @@
-
-
-
+
@@ -58,12 +49,6 @@
import NotFound from './routes/NotFound'
-export const RecipeCategories = {
- 0: "Petit-déjeuner",
- 1: "Entrée",
- 2: "Plat",
- 3: "Dessert"
-}
// *** TOOLS ***
//
// * create_recipe: go to creation page
@@ -83,7 +68,6 @@ export default {
data () {
return {
links: [],
- categories: RecipeCategories,
showNav: null,//
}
},
diff --git a/frontend/src/api.js b/frontend/src/api.js
index b4357cb..786d3c9 100644
--- a/frontend/src/api.js
+++ b/frontend/src/api.js
@@ -151,4 +151,5 @@ export default {
ingredients: mountNestedEndPoint(
`${baseUrl}/recips/*/amounts/`
),
+ meals: mountEndPoint(`${baseUrl}/planning/`),
}
diff --git a/frontend/src/components/CategoryTabs.vue b/frontend/src/components/CategoryTabs.vue
deleted file mode 100644
index 2756039..0000000
--- a/frontend/src/components/CategoryTabs.vue
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- {{ categories[key] }}
-
-
- arrow_back
-
-
-
-
-
diff --git a/frontend/src/components/RessourceField.vue b/frontend/src/components/RessourceField.vue
index d588c66..e1905b3 100644
--- a/frontend/src/components/RessourceField.vue
+++ b/frontend/src/components/RessourceField.vue
@@ -1,7 +1,6 @@
+
+
+ {{ day }}
+
+
+
+ Recette n°1
+ Recette n°2
+
+
+ delete
+
+
+
+
+
+
diff --git a/frontend/src/components/planning/Meal.vue b/frontend/src/components/planning/Meal.vue
new file mode 100644
index 0000000..d7a51d4
--- /dev/null
+++ b/frontend/src/components/planning/Meal.vue
@@ -0,0 +1,19 @@
+
+
+
+ {{ dish.name }}
+
+
+ ()
+
+
+
diff --git a/frontend/src/components/planning/Options.vue b/frontend/src/components/planning/Options.vue
new file mode 100644
index 0000000..037d3bb
--- /dev/null
+++ b/frontend/src/components/planning/Options.vue
@@ -0,0 +1,65 @@
+
+
+
+
+ Meal Options
+
+
+
+
+
+ Repas du { date }
+
+
+
+
+
+
+
+
+
+
+ Contenu
+
+
+
+
+ Qui mange ?
+
+ Liste des personnes
+
+
+
+ Règles spéciales
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/components/planning/Week.vue b/frontend/src/components/planning/Week.vue
new file mode 100644
index 0000000..e6bf848
--- /dev/null
+++ b/frontend/src/components/planning/Week.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+ {{ intervals_heading[indexFromHour(hour)] }}
+
+ more_horiz
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/components/recipes/Ingredient.vue b/frontend/src/components/recipes/Ingredient.vue
index 8d22405..7d176c5 100644
--- a/frontend/src/components/recipes/Ingredient.vue
+++ b/frontend/src/components/recipes/Ingredient.vue
@@ -72,6 +72,11 @@
},
markUpdated () {
this.updated = true
+ },
+ resetFields () {
+ this.item.ingredient = {}
+ this.item.amount = null
+ this.item.unit = null
}
},
watch: {
diff --git a/frontend/src/components/recipes/IngredientList.vue b/frontend/src/components/recipes/IngredientList.vue
index bdb7276..2a3f9db 100644
--- a/frontend/src/components/recipes/IngredientList.vue
+++ b/frontend/src/components/recipes/IngredientList.vue
@@ -1,26 +1,36 @@
-
+
+
+
+ Ingrédients
+
+
+
+
+
+
+
- Ingrédients
+ Nouveau
+
-
-
- (+)
-
+ >
+
+
diff --git a/frontend/src/router.js b/frontend/src/router.js
index d874ef1..4edb689 100644
--- a/frontend/src/router.js
+++ b/frontend/src/router.js
@@ -8,7 +8,6 @@ import Planning from './routes/Planning'
import RecipeDetails from './components/recipes/RecipeDetails'
import RecipeList from './components/recipes/RecipeList'
-import CategoryTabs from './components/CategoryTabs'
Vue.use(Router)
@@ -20,17 +19,16 @@ const router = new Router({
},
{ path: '/recipes',
- components: { default: Recipes,
- extension: CategoryTabs, },
+ component: Recipes,
meta: { title: "Recettes",
icon:"book" },
children: [
+ { path: '',
+ component: RecipeList,
+ meta: {}},
{ path: 'id/:id',
component: RecipeDetails,
meta: { subtitle: "Détails", } },
- { path: 'category/:cat',
- component: RecipeList,
- meta: { subtitle: "Liste", } },
{ path: '*',
component: NotFound }
]
diff --git a/frontend/src/routes/Planning.vue b/frontend/src/routes/Planning.vue
index fb34624..ce51f71 100644
--- a/frontend/src/routes/Planning.vue
+++ b/frontend/src/routes/Planning.vue
@@ -1,91 +1,38 @@
-
-
-
- {{item.header}}
-
-
-
- {{ item.subtitle }}
- {{ item.title }}
-
-
- remove_red_eye
-
-
-
-
- {{ item.title ? 'delete' : 'add' }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {{ error }}
+
+
+
+
+
+
+
+
diff --git a/frontend/src/routes/Recipes.vue b/frontend/src/routes/Recipes.vue
index c86da53..90c6e43 100644
--- a/frontend/src/routes/Recipes.vue
+++ b/frontend/src/routes/Recipes.vue
@@ -1,14 +1,13 @@
-
-
-
-
-
-
-
diff --git a/frontend/webpack-stats.json b/frontend/webpack-stats.json
index 12990bd..fe7d5f7 100644
--- a/frontend/webpack-stats.json
+++ b/frontend/webpack-stats.json
@@ -1 +1 @@
-{"status":"done","publicPath":"http://localhost:8080/","chunks":{"null":[{"name":"0.js","publicPath":"http://localhost:8080/0.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.js"}],"app":[{"name":"app.js","publicPath":"http://localhost:8080/app.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.js"},{"name":"app.bb93e89c95f5e29b766f.hot-update.js","publicPath":"http://localhost:8080/app.bb93e89c95f5e29b766f.hot-update.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.bb93e89c95f5e29b766f.hot-update.js"}]}}
\ No newline at end of file
+{"status":"done","publicPath":"http://localhost:8080/","error":"ModuleError","message":"Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):\n(Emitted value instead of an instance of Error) \n\n Errors compiling template:\n\n tag has no matching end tag.\n\n 12 | >\n 13 | \n 14 | \n | ^^^^^^^^\n 15 | \n 16 | {{ intervals_heading[indexFromHour(hour)] }}\n","chunks":{"null":[{"name":"0.js","publicPath":"http://localhost:8080/0.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.js"}],"app":[{"name":"app.js","publicPath":"http://localhost:8080/app.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.js"},{"name":"app.5ec28f6394212113d31d.hot-update.js","publicPath":"http://localhost:8080/app.5ec28f6394212113d31d.hot-update.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.5ec28f6394212113d31d.hot-update.js"}]}}
\ No newline at end of file
diff --git a/planning/models.py b/planning/models.py
index 8d90956..840f543 100644
--- a/planning/models.py
+++ b/planning/models.py
@@ -1,12 +1,20 @@
-from django.db import models
-from recipe_book.models import Recipe
-# Create your models here.
-
-class WeekPlanning(models.Model):
- pass
-
-
-class DayMeals(models.Model):
- midi = models.ForeignKey(
- Recipe,
- on_delete=models.CASCADE )
+from django.db import models
+from recipe_book.models import Recipe
+# Create your models here.
+
+class Meal(models.Model):
+ day = models.DateField()
+ kind = models.SmallIntegerField(choices=(
+ (0, 'Petit-déjeuner'),
+ (1, 'Déjeuner'),
+ (2, 'Goûter'),
+ (3, 'Diner'),
+ ))
+ dishes = models.ManyToManyField(
+ 'recipe_book.Recipe',
+ )
+
+ class Meta:
+ constraints = [
+ models.UniqueConstraint(fields=['day', 'kind'], name="unique_constraint"),
+ ]
diff --git a/planning/serializers.py b/planning/serializers.py
new file mode 100644
index 0000000..7b5d1dd
--- /dev/null
+++ b/planning/serializers.py
@@ -0,0 +1,8 @@
+from rest_framework import serializers as ser
+from .models import Meal
+
+class MealSerializer(ser.ModelSerializer):
+ class Meta:
+ model = Meal
+ fields = ('id', 'day', 'kind', 'dishes')
+ depth = 1
diff --git a/planning/views.py b/planning/views.py
index c60c790..0ba13d8 100644
--- a/planning/views.py
+++ b/planning/views.py
@@ -1,3 +1,9 @@
-from django.shortcuts import render
-
-# Create your views here.
+from django.shortcuts import render
+from rest_framework import viewsets
+from .serializers import MealSerializer
+from .models import Meal
+
+# Create your views here.
+class MealViewSet(viewsets.ModelViewSet):
+ queryset = Meal.objects.all()
+ serializer_class = MealSerializer