Make a start on the templates

This commit is contained in:
Maximilian Friedersdorff 2024-06-24 22:13:32 +01:00
parent 9f01e4bff2
commit 34c8bae899
6 changed files with 34 additions and 4 deletions

View file

@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Quick-start development settings - unsuitable for production
@ -58,7 +58,7 @@ ROOT_URLCONF = "config.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [BASE_DIR/"reinheit"/"templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [

View file

@ -1,6 +1,8 @@
from django.urls import path
from django.urls import path, include
from django.contrib import admin
urlpatterns = [
path("admin/", admin.site.urls),
path("brews/", include(("reinheit.apps.brew.urls", "brew"), namespace="brews"))
]

View file

@ -0,0 +1,7 @@
from django.urls import path
from .views import BrewListView
urlpatterns = [
path("brews/", BrewListView.as_view(), name="list")
]

View file

@ -1,3 +1,14 @@
from django.shortcuts import render
from django.views.generic import ListView
from .models import Brew
# Create your views here.
class BrewListView(ListView):
model = Brew
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
print(context)
return context

View file

@ -0,0 +1,2 @@
<html>
</html>

View file

@ -0,0 +1,8 @@
{% include "base.html" %}
{% block content %}
{% for brew in brew_list %}
{{ brew }}
{% endfor %}
{% endblock content %}