Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
ce91f9e6
Commit
ce91f9e6
authored
Mar 24, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly use serializers
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
94d13960
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
weblate/api/serializers.py
weblate/api/serializers.py
+13
-3
weblate/api/views.py
weblate/api/views.py
+1
-2
No files found.
weblate/api/serializers.py
View file @
ce91f9e6
...
...
@@ -130,9 +130,19 @@ class TranslationSerializer(serializers.ModelSerializer):
}
class
LockSerializer
(
serializers
.
Serializer
):
locked
=
serializers
.
BooleanField
()
class
ReadOnlySerializer
(
serializers
.
Serializer
):
def
update
(
self
,
instance
,
validated_data
):
return
None
def
create
(
self
,
validated_data
):
return
None
class
LockRequestSerializer
(
serializers
.
Serializer
):
class
LockSerializer
(
serializers
.
ModelSerializer
):
class
Meta
(
object
):
model
=
SubProject
fields
=
(
'locked'
,
)
class
LockRequestSerializer
(
ReadOnlySerializer
):
lock
=
serializers
.
BooleanField
()
weblate/api/views.py
View file @
ce91f9e6
...
...
@@ -24,7 +24,6 @@ from django.http import Http404
from
rest_framework
import
parsers
,
viewsets
from
rest_framework.decorators
import
detail_route
from
rest_framework.exceptions
import
ParseError
from
rest_framework.response
import
Response
from
weblate.api.serializers
import
(
...
...
@@ -126,7 +125,7 @@ class ComponentViewSet(MultipleFieldMixin, viewsets.ReadOnlyModelViewSet):
else
:
obj
.
do_unlock
(
request
.
user
)
return
Response
(
data
=
{
'locked'
:
obj
.
locked
}
)
return
Response
(
data
=
LockSerializer
(
obj
).
data
)
class
TranslationViewSet
(
MultipleFieldMixin
,
FileExportViewSet
):
...
...
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