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
02188b0a
Commit
02188b0a
authored
Mar 22, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include parent objects nested
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
818d1a8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
weblate/api/serializers.py
weblate/api/serializers.py
+15
-8
weblate/api/views.py
weblate/api/views.py
+1
-0
No files found.
weblate/api/serializers.py
View file @
02188b0a
...
...
@@ -24,7 +24,17 @@ from weblate.trans.models import Project, SubProject, Translation
from
weblate.lang.models
import
Language
class
LanguageSerializer
(
serializers
.
ModelSerializer
):
class
Meta
(
object
):
model
=
Language
fields
=
(
'id'
,
'code'
,
'name'
,
'nplurals'
,
'pluralequation'
,
'direction'
,
)
class
ProjectSerializer
(
serializers
.
ModelSerializer
):
source_language
=
LanguageSerializer
(
read_only
=
True
)
class
Meta
(
object
):
model
=
Project
fields
=
(
...
...
@@ -33,6 +43,8 @@ class ProjectSerializer(serializers.ModelSerializer):
class
ComponentSerializer
(
serializers
.
ModelSerializer
):
project
=
ProjectSerializer
(
read_only
=
True
)
class
Meta
(
object
):
model
=
SubProject
fields
=
(
...
...
@@ -43,6 +55,9 @@ class ComponentSerializer(serializers.ModelSerializer):
class
TranslationSerializer
(
serializers
.
ModelSerializer
):
subproject
=
ComponentSerializer
(
read_only
=
True
)
language
=
LanguageSerializer
(
read_only
=
True
)
class
Meta
(
object
):
model
=
Translation
fields
=
(
...
...
@@ -51,11 +66,3 @@ class TranslationSerializer(serializers.ModelSerializer):
'total_words'
,
'failing_checks'
,
'have_suggestion'
,
'have_comment'
,
'language_code'
,
'filename'
,
'revision'
,
)
class
LanguageSerializer
(
serializers
.
ModelSerializer
):
class
Meta
(
object
):
model
=
Language
fields
=
(
'id'
,
'code'
,
'name'
,
'nplurals'
,
'pluralequation'
,
'direction'
,
)
weblate/api/views.py
View file @
02188b0a
...
...
@@ -33,6 +33,7 @@ class ProjectViewSet(viewsets.ReadOnlyModelViewSet):
"""
queryset
=
Project
.
objects
.
none
()
serializer_class
=
ProjectSerializer
lookup_field
=
'slug'
def
get_queryset
(
self
):
return
Project
.
objects
.
all_acl
(
self
.
request
.
user
)
...
...
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