Initial plant reference and basic login

This commit is contained in:
kit 2025-12-03 12:34:46 +00:00
parent a2dba58fe4
commit cada3c7357
31 changed files with 637 additions and 0 deletions

21
planterteque/views.py Normal file
View file

@ -0,0 +1,21 @@
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse, Http404
from django.template import loader
from .models import Plant
def index(request):
latest_plants_list = Plant.objects.order_by("-create_date")[:5]
context = { "latest_plants_list": latest_plants_list }
return render( request, "planterteque/index.html", context )
def reference(request, plant_id):
try:
plant = Plant.objects.get( pk=plant_id )
except Plant.DoesNotExist:
raise Http404("Plant does not exist")
context = { "plant": plant }
return render( request, "planterteque/reference.html", context )