Skip to content

Commit 28d67b4

Browse files
author
vivapyk
committed
partial main_page
1 parent ea0eaa3 commit 28d67b4

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

main/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ def __str__(self):
3636
return self.title
3737

3838

39+

main/templates/detail.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% extends base.html %}

main/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
from main.views import main_post
44

55
urlpatterns = [
6-
path('', main_post, name='main')
6+
path('', main_post, name='main'),
7+
path('<int:pk>', main_detail, name='detail')
78
]

main/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
from main.models import Post
44

5+
# Create your views here.
6+
7+
58
def main_post(request):
69
post = Post.objects.all()
710
data = {
811
'post': post
912
}
1013
return render(request, 'main.html', data)
1114

12-
# Create your views here.
15+
16+
def main_detail(request, pk):
17+
post = Post.objects.get(pk=pk)
18+
data = {
19+
'post' : post
20+
}
21+
return render(request, 'detail.html', data)
22+

0 commit comments

Comments
 (0)