Build all_projects view
This commit is contained in:
parent
77a2e7d954
commit
edaa41811f
|
@ -2,5 +2,6 @@ from django.urls import path
|
|||
from projects import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.all_projects),
|
||||
path("test", views.project_list),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
from django.shortcuts import render
|
||||
from projects.models import Project
|
||||
|
||||
# Create your views here.
|
||||
def project_list(request):
|
||||
return render(request, "projects/index.html")
|
||||
|
||||
|
||||
def all_projects(request):
|
||||
# query the db to return all project objects
|
||||
projects = Project.objects.all()
|
||||
return render(request, "all_projects.html", {"projects": projects})
|
||||
|
|
Loading…
Reference in New Issue