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
1d482920
Commit
1d482920
authored
Nov 03, 2021
by
Борис Ким
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил во все вьюхи Login mixin для аутентифициорованных пользователей
parent
f217ed60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
courses_views.py
source/webapp/views/courses_views.py
+7
-5
No files found.
source/webapp/views/courses_views.py
View file @
1d482920
from
django.conf
import
settings
from
django.shortcuts
import
redirect
from
django.urls.base
import
reverse_lazy
from
django.views.generic
import
ListView
,
CreateView
,
DetailView
,
DeleteView
from
django.views.generic
import
UpdateView
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
webapp.models
import
Course
from
webapp.forms
import
CourseForm
class
CourseCreateView
(
CreateView
):
class
CourseCreateView
(
LoginRequiredMixin
,
CreateView
):
template_name
=
'courses/create.html'
form_class
=
CourseForm
model
=
Course
...
...
@@ -25,19 +27,19 @@ class CoursesListView(ListView):
paginate_by
=
6
class
CourseDetailView
(
DetailView
):
class
CourseDetailView
(
LoginRequiredMixin
,
DetailView
):
model
=
Course
template_name
=
'courses/detail.html'
pk_url_kwarg
=
'course_pk'
class
CourseDeleteView
(
DeleteView
):
class
CourseDeleteView
(
LoginRequiredMixin
,
DeleteView
):
model
=
Course
template_name
=
'courses/delete.html'
success_url
=
reverse_lazy
(
'webapp:courses_list'
)
class
CourseEditView
(
UpdateView
):
class
CourseEditView
(
LoginRequiredMixin
,
UpdateView
):
model
=
Course
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