Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
kszkepzes
old
kszkepzes-backend
Commits
3bb776bc
Commit
3bb776bc
authored
7 years ago
by
Barnabás Czémán
Browse files
Options
Downloads
Patches
Plain Diff
Make news public
parent
5ac55df1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/news/permissions.py
+2
-2
2 additions, 2 deletions
src/news/permissions.py
src/news/views.py
+2
-2
2 additions, 2 deletions
src/news/views.py
with
4 additions
and
4 deletions
src/news/permissions.py
+
2
−
2
View file @
3bb776bc
...
...
@@ -2,6 +2,6 @@ from rest_framework.permissions import BasePermission
from
rest_framework.permissions
import
SAFE_METHODS
class
IsStaffOrReadOnly
ForAuthenticated
(
BasePermission
):
class
IsStaffOrReadOnly
(
BasePermission
):
def
has_permission
(
self
,
request
,
view
):
return
request
.
user
.
is_staff
or
request
.
method
in
SAFE_METHODS
and
request
.
user
.
is_authenticated
return
request
.
user
.
is_staff
or
request
.
method
in
SAFE_METHODS
This diff is collapsed.
Click to expand it.
src/news/views.py
+
2
−
2
View file @
3bb776bc
from
news.permissions
import
IsStaffOrReadOnly
ForAuthenticated
from
news.permissions
import
IsStaffOrReadOnly
from
rest_framework
import
viewsets
from
news.models
import
Article
from
news.serializers
import
ArticleListSerializer
...
...
@@ -6,5 +6,5 @@ from news.serializers import ArticleListSerializer
class
NewsViewSet
(
viewsets
.
ModelViewSet
):
serializer_class
=
ArticleListSerializer
permission_classes
=
[
IsStaffOrReadOnly
ForAuthenticated
]
permission_classes
=
[
IsStaffOrReadOnly
]
queryset
=
Article
.
objects
.
all
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment