Commit 8b8afca7 authored by Борис Ким's avatar Борис Ким

Добавил вью для детального просмотра курса

parent 69d44efd
...@@ -19,5 +19,6 @@ from webapp.views import courses_views as webapp_views ...@@ -19,5 +19,6 @@ from webapp.views import courses_views as webapp_views
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', webapp_views.CoursesListView.as_view(), name='courses_list') path('', webapp_views.CoursesListView.as_view(), name='courses_list'),
path('course/<int:course_pk>/', webapp_views.CourseDetailView.as_view(), name='course_detail')
] ]
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a> <a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title"> {{course.title}} </h5> <h5 class="card-title"> {{course.title}} </h5>
<p class="card-text"> {{course.description}} </p> <p class="card-text"> {{course.description}} </p>
<a class="btn btn-primary" href="{% url 'course_detail' course.id %}"> See more </a>
</div> </div>
</div> </div>
</div> </div>
......
{% extends 'base.html' %}
{% block title %} {{course.title}} {% endblock %}
{% block content %}
<div class='course-block-detail'>
<div class="card">
<div class="card-header">
{{course.title}}
</div>
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
...@@ -10,3 +10,9 @@ class CoursesListView(ListView): ...@@ -10,3 +10,9 @@ class CoursesListView(ListView):
context_object_name = 'courses' context_object_name = 'courses'
template_name = 'courses/courses_list.html' template_name = 'courses/courses_list.html'
paginate_by = 9 paginate_by = 9
class CourseDetailView(DetailView):
model = Course
template_name = 'courses/detail.html'
pk_url_kwarg = 'course_pk'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment