Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Hsin-Yu Chien
edx-platform-release
Commits
0cce3155
Commit
0cce3155
authored
3 years ago
by
stvn
Browse files
Options
Downloads
Patches
Plain Diff
refactor: Base discussions serializer off of ModelSerializer
to make Django operations easier.
parent
3f6f6e36
No related branches found
Branches containing commit
Tags
release-2021-04-08-07.47
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/core/djangoapps/discussions/views.py
+11
-5
11 additions, 5 deletions
openedx/core/djangoapps/discussions/views.py
with
11 additions
and
5 deletions
openedx/core/djangoapps/discussions/views.py
+
11
−
5
View file @
0cce3155
...
...
@@ -33,10 +33,17 @@ class DiscussionsConfigurationView(APIView):
"""
permission_classes
=
(
IsStaff
,)
class
Serializer
(
serializers
.
Base
Serializer
):
class
Serializer
(
serializers
.
Model
Serializer
):
"""
Serialize configuration responses
"""
class
Meta
:
model
=
DiscussionsConfiguration
fields
=
[
'
context_key
'
,
'
enabled
'
,
'
provider_type
'
,
]
def
to_internal_value
(
self
,
data
):
"""
...
...
@@ -48,9 +55,8 @@ class DiscussionsConfigurationView(APIView):
"""
Serialize data into a dictionary, to be used as a response
"""
payload
=
{
'
context_key
'
:
str
(
instance
.
context_key
),
'
enabled
'
:
instance
.
enabled
,
payload
=
super
().
to_representation
(
instance
)
payload
.
update
({
'
features
'
:
{
'
discussion-page
'
,
'
embedded-course-sections
'
,
...
...
@@ -67,7 +73,7 @@ class DiscussionsConfigurationView(APIView):
for
provider
in
instance
.
available_providers
},
},
}
}
)
return
payload
def
update
(
self
,
instance
,
validated_data
):
...
...
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