first view with query

This commit is contained in:
gw3000 2023-06-08 20:48:33 +02:00
parent 1bbb171ac2
commit 217b4c522b
8 changed files with 55 additions and 6 deletions

View file

@ -20,7 +20,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-)g-j2v+*dvjtnz)q-3+*y7*lq$el$im8p^wr@2v$g^u99quq50" SECRET_KEY = ")g-j2v+*dvjtnz)q-3+*y7*lq$el$im8p^wr@2v$g^u99quq50"
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
@ -90,16 +90,20 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", "NAME":
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
}, },
{ {
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", "NAME":
"django.contrib.auth.password_validation.MinimumLengthValidator",
}, },
{ {
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", "NAME":
"django.contrib.auth.password_validation.CommonPasswordValidator",
}, },
{ {
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", "NAME":
"django.contrib.auth.password_validation.NumericPasswordValidator",
}, },
] ]

View file

@ -1,4 +1,5 @@
from django.shortcuts import render, HttpResponse from django.shortcuts import render, HttpResponse
from .models import FallenBird
def bird_create(request): def bird_create(request):
@ -6,11 +7,14 @@ def bird_create(request):
def bird_all(request): def bird_all(request):
birds_all = FallenBird.objects.all()
for bird in birds_all:
print(bird)
return HttpResponse("Show all Birds") return HttpResponse("Show all Birds")
def bird_recover_all(request): def bird_recover_all(request):
return HttpResponse(f"Show all recovered Birds") return HttpResponse("Show all recovered Birds")
def bird_single(request, id): def bird_single(request, id):

0
static/.gitkeep Normal file
View file

0
static/css/.gitkeep Normal file
View file

0
static/img/.gitkeep Normal file
View file

41
templates/base.html Normal file
View file

@ -0,0 +1,41 @@
{load static}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{% comment %} favicon {% endcomment %}
<link rel="shortcut icon" href="{% static 'img/favicon.ico' %}" type="image/x-icon">
{% comment %} css {% endcomment %}
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
{% comment %} possible dynamic header {% endcomment %}
<title>{% block head_title %}lv&middot;rb{% endblock %}</title>
{% comment %} custom header {% endcomment %}
{% block header %} {% endblock header %}
</head>
<body>
<!--navbar-->
{% block navbar %}
{% include 'partials/_navbar.html' %}
{% endblock navbar %}
<!--content-->
<div class="container">
{% block content %}
{% endblock content %}
</div>
<!--footer-->
{% block footer %}
{% include 'partials/_footer.html' %}
{% endblock footer %}
<!-- JavaScript Bundle with Popper -->
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
</body>

View file

View file