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

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

parent 69d44efd
......@@ -19,5 +19,6 @@ from webapp.views import courses_views as webapp_views
urlpatterns = [
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 @@
<title>{% block title %}{% endblock %}</title>
</head>
<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>
<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>
......
......@@ -13,6 +13,7 @@
<div class="card-body">
<h5 class="card-title"> {{course.title}} </h5>
<p class="card-text"> {{course.description}} </p>
<a class="btn btn-primary" href="{% url 'course_detail' course.id %}"> See more </a>
</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
......@@ -9,4 +9,10 @@ class CoursesListView(ListView):
model = Course
context_object_name = 'courses'
template_name = 'courses/courses_list.html'
paginate_by = 9
\ No newline at end of file
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