first urls and simple views
This commit is contained in:
parent
1945ab39c5
commit
0c8ec0f8d1
3 changed files with 24 additions and 4 deletions
|
@ -15,8 +15,9 @@ Including another URLconf
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, include
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path("bird/", include("fbf.urls")),
|
||||||
|
path("admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
9
fbf/urls.py
Normal file
9
fbf/urls.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from .views import bird_create, bird_all, bird_single
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("create/", bird_create, name="fallen_bird_create"),
|
||||||
|
path("all/", bird_all, name="fallen_bird_all"),
|
||||||
|
path("<id>/", bird_single, name="fallen_bird_single"),
|
||||||
|
]
|
14
fbf/views.py
14
fbf/views.py
|
@ -1,3 +1,13 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render, HttpResponse
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
def bird_create(request):
|
||||||
|
return HttpResponse("Create a bird")
|
||||||
|
|
||||||
|
|
||||||
|
def bird_all(request):
|
||||||
|
return HttpResponse("Show all Birds")
|
||||||
|
|
||||||
|
|
||||||
|
def bird_single(request, id):
|
||||||
|
return HttpResponse(f"Show bird with ID {id}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue