diff --git a/config/settings/base.py b/config/settings/base.py index 1e6490e..bc9459a 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -44,6 +44,7 @@ INSTALLED_APPS = [ "reinheit.apps.styles", "reinheit.apps.ingredients", "reinheit.apps.user", + "reinheit.apps.shopping", ] MIDDLEWARE = [ diff --git a/config/urls.py b/config/urls.py index 9474af6..7c9c528 100644 --- a/config/urls.py +++ b/config/urls.py @@ -6,5 +6,6 @@ urlpatterns = [ path("", RedirectView.as_view(url="/brews/")), path("admin/", admin.site.urls), path("brews/", include(("reinheit.apps.brew.urls", "brew"), namespace="brews")), + path("shopping/", include(("reinheit.apps.shopping.urls", "shopping"), namespace="shopping")), path("oidc/", include("oauth2_authcodeflow.urls")), ] diff --git a/reinheit/apps/shopping/__init__.py b/reinheit/apps/shopping/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/reinheit/apps/shopping/admin.py b/reinheit/apps/shopping/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/reinheit/apps/shopping/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/reinheit/apps/shopping/apps.py b/reinheit/apps/shopping/apps.py new file mode 100644 index 0000000..d5aae11 --- /dev/null +++ b/reinheit/apps/shopping/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ShoppingConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "reinheit.apps.shopping" diff --git a/reinheit/apps/shopping/migrations/__init__.py b/reinheit/apps/shopping/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/reinheit/apps/shopping/models.py b/reinheit/apps/shopping/models.py new file mode 100644 index 0000000..31b2044 --- /dev/null +++ b/reinheit/apps/shopping/models.py @@ -0,0 +1,34 @@ +from django.db import models + +# Create your models here. +class Item(models.Model): + name = models.CharField(max_length=255) + + def __str__(self): + return self.name + + +class Recipe(models.Model): + class TimeRequired(models.IntegerChoices): + LOW = 1, "Low" + MEDIUM = 2, "Medium" + HIGH = 3, "High" + + name = models.CharField(max_length=255) + ingredients = models.ManyToManyField(Item) + + time_required = models.PositiveIntegerField(choices=TimeRequired) + + def __str__(self): + return self.name + + +class ShoppingList(models.Model): + + date = models.DateField() + + meals = models.ManyToManyField(Recipe) + other = models.ManyToManyField(Item) + + def __str__(self): + return f"List for {self.date}" diff --git a/reinheit/apps/shopping/tests.py b/reinheit/apps/shopping/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/reinheit/apps/shopping/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/reinheit/apps/shopping/views.py b/reinheit/apps/shopping/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/reinheit/apps/shopping/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.