Commit ce96eac0 authored by Michal Čihař's avatar Michal Čihař

Include self URL in the objects

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 4ec50e0e
...@@ -31,8 +31,14 @@ class LanguageSerializer(serializers.ModelSerializer): ...@@ -31,8 +31,14 @@ class LanguageSerializer(serializers.ModelSerializer):
model = Language model = Language
fields = ( fields = (
'code', 'name', 'nplurals', 'pluralequation', 'direction', 'code', 'name', 'nplurals', 'pluralequation', 'direction',
'web_url', 'web_url', 'url',
) )
extra_kwargs = {
'url': {
'view_name': 'api:language-detail',
'lookup_field': 'code'
}
}
class ProjectSerializer(serializers.ModelSerializer): class ProjectSerializer(serializers.ModelSerializer):
...@@ -42,8 +48,14 @@ class ProjectSerializer(serializers.ModelSerializer): ...@@ -42,8 +48,14 @@ class ProjectSerializer(serializers.ModelSerializer):
class Meta(object): class Meta(object):
model = Project model = Project
fields = ( fields = (
'id', 'name', 'slug', 'web', 'source_language', 'web_url' 'name', 'slug', 'web', 'source_language', 'web_url', 'url',
) )
extra_kwargs = {
'url': {
'view_name': 'api:project-detail',
'lookup_field': 'slug'
}
}
class ComponentSerializer(serializers.ModelSerializer): class ComponentSerializer(serializers.ModelSerializer):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment