next view and rendering it

This commit is contained in:
gw3000 2023-06-09 09:20:27 +02:00
parent 259c68692b
commit fef67254ee
5 changed files with 13 additions and 8 deletions

View file

@ -10,6 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/ https://docs.djangoproject.com/en/4.2/ref/settings/
""" """
import os
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'.
@ -58,7 +59,7 @@ ROOT_URLCONF = "core.urls"
TEMPLATES = [ TEMPLATES = [
{ {
"BACKEND": "django.template.backends.django.DjangoTemplates", "BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [], "DIRS": [os.path.join(BASE_DIR, 'templates')],
"APP_DIRS": True, "APP_DIRS": True,
"OPTIONS": { "OPTIONS": {
"context_processors": [ "context_processors": [
@ -123,7 +124,10 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/ # https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = "static/" STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static"
]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

View file

@ -7,10 +7,9 @@ def bird_create(request):
def bird_all(request): def bird_all(request):
birds_all = FallenBird.objects.all() birds = FallenBird.objects.all()
for bird in birds_all: context = {'birds': birds}
print(bird) return render(request, 'fbf/birds_all.html', context)
return HttpResponse("Show all Birds")
def bird_recover_all(request): def bird_recover_all(request):

View file

@ -1,4 +1,4 @@
{load static} {% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -14,7 +14,7 @@
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"> <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
{% comment %} possible dynamic header {% endcomment %} {% comment %} possible dynamic header {% endcomment %}
<title>{% block head_title %}lv&middot;rb{% endblock %}</title> <title>{% block head_title %}Fallen Birdy{% endblock %}</title>
{% comment %} custom header {% endcomment %} {% comment %} custom header {% endcomment %}
{% block header %} {% endblock header %} {% block header %} {% endblock header %}

View file

@ -0,0 +1 @@
footer

View file

@ -0,0 +1 @@
navbar