Make a start on the templates
This commit is contained in:
parent
9f01e4bff2
commit
34c8bae899
6 changed files with 34 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# 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
|
# Quick-start development settings - unsuitable for production
|
||||||
|
|
@ -58,7 +58,7 @@ ROOT_URLCONF = "config.urls"
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||||
"DIRS": [],
|
"DIRS": [BASE_DIR/"reinheit"/"templates"],
|
||||||
"APP_DIRS": True,
|
"APP_DIRS": True,
|
||||||
"OPTIONS": {
|
"OPTIONS": {
|
||||||
"context_processors": [
|
"context_processors": [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
from django.urls import path
|
from django.urls import path, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
|
|
||||||
|
path("brews/", include(("reinheit.apps.brew.urls", "brew"), namespace="brews"))
|
||||||
]
|
]
|
||||||
|
|
|
||||||
7
reinheit/apps/brew/urls.py
Normal file
7
reinheit/apps/brew/urls.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from .views import BrewListView
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("brews/", BrewListView.as_view(), name="list")
|
||||||
|
]
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
from django.shortcuts import render
|
from django.views.generic import ListView
|
||||||
|
|
||||||
|
from .models import Brew
|
||||||
|
|
||||||
# Create your views here.
|
# 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
|
||||||
|
|
|
||||||
2
reinheit/templates/base.html
Normal file
2
reinheit/templates/base.html
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<html>
|
||||||
|
</html>
|
||||||
8
reinheit/templates/brew/brew_list.html
Normal file
8
reinheit/templates/brew/brew_list.html
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% include "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% for brew in brew_list %}
|
||||||
|
{{ brew }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endblock content %}
|
||||||
Loading…
Add table
Reference in a new issue