Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coursework
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Борис Ким
coursework
Commits
2a9d1e34
Commit
2a9d1e34
authored
Nov 01, 2021
by
Борис Ким
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил вью для отображения курсов
parent
ea6730bc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
urls.py
source/portal/urls.py
+1
-1
courses_list.html
source/webapp/templates/courses/courses_list.html
+16
-0
courses_views.py
source/webapp/views/courses_views.py
+9
-2
No files found.
source/portal/urls.py
View file @
2a9d1e34
...
@@ -19,5 +19,5 @@ from webapp.views import courses_views as webapp_views
...
@@ -19,5 +19,5 @@ from webapp.views import courses_views as webapp_views
urlpatterns
=
[
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
''
,
webapp_views
.
my_view
,
name
=
'main
'
)
path
(
''
,
webapp_views
.
CoursesListView
.
as_view
(),
name
=
'courses_list
'
)
]
]
source/webapp/templates/courses/courses_list.html
0 → 100644
View file @
2a9d1e34
{% block title %} List {% endblock %}
{% block content %}
{% for course in courses %}
<div
class=
"card"
>
<div
class=
"card-header"
>
Featured
</div>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
{{course.title}}
</h5>
<p
class=
"card-text"
>
{{course.description}}
</p>
<a
href=
"#"
class=
"btn btn-primary"
>
Go somewhere
</a>
</div>
</div>
{% endfor %}
{% endblock %}
\ No newline at end of file
source/webapp/views/courses_views.py
View file @
2a9d1e34
from
typing
import
List
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic
import
ListView
,
CreateView
,
DeleteView
,
UpdateView
,
DetailView
from
webapp.models
import
Course
def
my_view
(
request
):
return
render
(
request
,
'base.html'
)
class
CoursesListView
(
ListView
):
\ No newline at end of file
model
=
Course
context_object_name
=
'courses'
template_name
=
'courses/courses_list.html'
paginate_by
=
9
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment