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
bfb154c2
Commit
bfb154c2
authored
Nov 02, 2021
by
Борис Ким
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал вывод уроков в курсах
parent
dd71938d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
8 deletions
+43
-8
urls.py
source/portal/urls.py
+2
-1
courses_list.html
source/webapp/templates/courses/courses_list.html
+1
-1
detail.html
source/webapp/templates/courses/detail.html
+13
-1
edit.html
source/webapp/templates/courses/edit.html
+19
-0
courses_views.py
source/webapp/views/courses_views.py
+8
-5
No files found.
source/portal/urls.py
View file @
bfb154c2
...
@@ -22,5 +22,6 @@ urlpatterns = [
...
@@ -22,5 +22,6 @@ urlpatterns = [
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'
),
path
(
'course/<int:course_pk>/'
,
webapp_views
.
CourseDetailView
.
as_view
(),
name
=
'course_detail'
),
path
(
'course/<int:pk>/delete/'
,
webapp_views
.
CourseDeleteView
.
as_view
(),
name
=
'course_delete'
),
path
(
'course/<int:pk>/delete/'
,
webapp_views
.
CourseDeleteView
.
as_view
(),
name
=
'course_delete'
),
path
(
'course/new/'
,
webapp_views
.
CourseCreateView
.
as_view
(),
name
=
'course_create'
)
path
(
'course/new/'
,
webapp_views
.
CourseCreateView
.
as_view
(),
name
=
'course_create'
),
path
(
'course/<int:pk>/edit/'
,
webapp_views
.
CourseEditView
.
as_view
(),
name
=
'course_edit'
)
]
]
source/webapp/templates/courses/courses_list.html
View file @
bfb154c2
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</div>
</div>
<div
class=
"card-buttons"
style=
"text-align: center;"
>
<div
class=
"card-buttons"
style=
"text-align: center;"
>
<a
class=
"btn btn-primary"
href=
"{% url 'course_detail' course.id %}"
>
See more
</a>
<a
class=
"btn btn-primary"
href=
"{% url 'course_detail' course.id %}"
>
See more
</a>
<a
class=
"btn btn-info"
href=
"
#
"
>
Edit
</a>
<a
class=
"btn btn-info"
href=
"
{% url 'course_edit' course.id %}
"
>
Edit
</a>
<a
class=
"btn btn-danger"
href=
"{% url 'course_delete' course.id %}"
>
Delete
</a>
<a
class=
"btn btn-danger"
href=
"{% url 'course_delete' course.id %}"
>
Delete
</a>
</div>
</div>
</div>
</div>
...
...
source/webapp/templates/courses/detail.html
View file @
bfb154c2
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<a
href=
"{% url "
courses_list
"
%}"
>
<
<
Return
to
the
main
page
..</
a
>
<a
href=
"{% url "
courses_list
"
%}"
>
<
<
Return
to
the
main
page
..</
a
>
<hr>
<hr>
<div
class=
'course-block-detail'
>
<div
class=
'course-block-detail'
>
<div
class=
"card"
>
<div
class=
"card"
style=
"width: 100%; height: 400px;"
>
<div
class=
"card-header"
>
<div
class=
"card-header"
>
<h4>
{{course.title}}
</h4>
<h4>
{{course.title}}
</h4>
</div>
</div>
...
@@ -20,6 +20,18 @@
...
@@ -20,6 +20,18 @@
</div>
</div>
</div>
</div>
</div>
</div>
{% for class in course.courses.all %}
<div
class=
"card border-dark mb-3"
style=
"max-width: 100%; height: 200px; margin: 15px auto;"
>
<div
class=
"card-header"
>
<p>
<b>
Created at:
</b>
{{ class.created_at }} -
<b>
by:
</b>
{{ course.teacher }}
</p>
</div>
<div
class=
"card-body text-dark"
>
<h5
class=
"card-title"
>
Topic: {{ class.title }}
</h5>
<p
class=
"card-text"
>
Description: {{ class.description|truncatewords:5 }}
</p>
{{ class.file }}
</div>
</div>
{% endfor %}
<hr>
<hr>
<a
href=
"{% url "
courses_list
"
%}"
>
<
<
Return
to
the
main
page
..</
a
>
<a
href=
"{% url "
courses_list
"
%}"
>
<
<
Return
to
the
main
page
..</
a
>
{% endblock %}
{% endblock %}
\ No newline at end of file
source/webapp/templates/courses/edit.html
0 → 100644
View file @
bfb154c2
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% block title %} Edit Course {% endblock %}
{% block content %}
<a
href=
"{% url "
courses_list
"
%}"
>
Return to the main page..
</a>
<hr>
<h1>
Edit course "{{ course.title }}"
</h1>
<div
class=
'column-center'
>
<form
method=
"POST"
>
{% csrf_token %}
{{ form|crispy }}
</form>
</div>
<hr>
<a
href=
"{% url "
courses_list
"
%}"
>
Return to the main page..
</a>
{% endblock %}
source/webapp/views/courses_views.py
View file @
bfb154c2
from
typing
import
List
from
django.shortcuts
import
get_object_or_404
,
render
from
django.
shortcuts
import
render
from
django.
urls.base
import
reverse
,
reverse_lazy
from
django.
urls.base
import
reverse_lazy
from
django.
views.generic
import
ListView
,
CreateView
,
DetailView
,
DeleteView
from
django.views.generic
import
ListView
,
CreateView
,
UpdateView
,
DetailView
,
Dele
teView
from
django.views.generic
import
Upda
teView
from
webapp.models
import
Course
from
webapp.models
import
Course
...
@@ -39,4 +39,7 @@ class CourseDeleteView(DeleteView):
...
@@ -39,4 +39,7 @@ class CourseDeleteView(DeleteView):
class
CourseEditView
(
UpdateView
):
class
CourseEditView
(
UpdateView
):
pass
model
=
Course
\ No newline at end of file
fields
=
[
'title'
,
'description'
,
'start_date'
]
template_name
=
'courses/edit.html'
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