Add slug field to CategoryResource, update docs.
This commit is contained in:
Родитель
9110d96da4
Коммит
b4998e7f09
|
@ -20,7 +20,8 @@ Returns the list of categories::
|
|||
"previous": null, "total_count": 1},
|
||||
"objects":
|
||||
[{"id": 1, "name": "Webapp",
|
||||
"resource_uri": "/api/apps/category/1/"}]
|
||||
"resource_uri": "/api/apps/category/1/",
|
||||
"slug": "webapp"}]
|
||||
}
|
||||
|
||||
Use the `id` of the category in your app updating.
|
||||
|
|
|
@ -271,7 +271,7 @@ class CategoryResource(MarketplaceResource):
|
|||
weight__gte=0)
|
||||
list_allowed_methods = ['get']
|
||||
allowed_methods = ['get']
|
||||
fields = ['name', 'id']
|
||||
fields = ['name', 'id', 'slug']
|
||||
always_return_data = True
|
||||
resource_name = 'category'
|
||||
serializer = Serializer(formats=['json'])
|
||||
|
|
|
@ -556,7 +556,8 @@ class TestCategoryHandler(BaseOAuth):
|
|||
def setUp(self):
|
||||
super(TestCategoryHandler, self).setUp()
|
||||
self.cat = Category.objects.create(name='Webapp',
|
||||
type=amo.ADDON_WEBAPP)
|
||||
type=amo.ADDON_WEBAPP,
|
||||
slug='thewebapp')
|
||||
self.cat.name = {'fr': 'Le Webapp'}
|
||||
self.cat.save()
|
||||
self.other = Category.objects.create(name='other',
|
||||
|
@ -583,6 +584,7 @@ class TestCategoryHandler(BaseOAuth):
|
|||
data = json.loads(res.content)
|
||||
eq_(data['meta']['total_count'], 1)
|
||||
eq_(data['objects'][0]['name'], 'Webapp')
|
||||
eq_(data['objects'][0]['slug'], 'thewebapp')
|
||||
|
||||
def test_get_category(self):
|
||||
res = self.client.get(self.get_url)
|
||||
|
|
Загрузка…
Ссылка в новой задаче