Add beginnings of a shopping app
This commit is contained in:
parent
bfa660f53c
commit
1ce10bf254
9 changed files with 51 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ INSTALLED_APPS = [
|
|||
"reinheit.apps.styles",
|
||||
"reinheit.apps.ingredients",
|
||||
"reinheit.apps.user",
|
||||
"reinheit.apps.shopping",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
|
|||
|
|
@ -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")),
|
||||
]
|
||||
|
|
|
|||
0
reinheit/apps/shopping/__init__.py
Normal file
0
reinheit/apps/shopping/__init__.py
Normal file
3
reinheit/apps/shopping/admin.py
Normal file
3
reinheit/apps/shopping/admin.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
reinheit/apps/shopping/apps.py
Normal file
6
reinheit/apps/shopping/apps.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ShoppingConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "reinheit.apps.shopping"
|
||||
0
reinheit/apps/shopping/migrations/__init__.py
Normal file
0
reinheit/apps/shopping/migrations/__init__.py
Normal file
34
reinheit/apps/shopping/models.py
Normal file
34
reinheit/apps/shopping/models.py
Normal file
|
|
@ -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}"
|
||||
3
reinheit/apps/shopping/tests.py
Normal file
3
reinheit/apps/shopping/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
reinheit/apps/shopping/views.py
Normal file
3
reinheit/apps/shopping/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Loading…
Add table
Reference in a new issue