Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Add an option to serialize as an Object #29

Open
afk-mario opened this issue Mar 2, 2016 · 1 comment
Open

Add an option to serialize as an Object #29

afk-mario opened this issue Mar 2, 2016 · 1 comment

Comments

@afk-mario
Copy link

Currently the serializer outputs something like this:

"tags": [
    "pixel art",
    "unity"
]

iIt would be nice to have the option for it to be:

{
   "tags":[
      {
         "id":2,
         "name":"web"
      },
      {
         "id":1,
         "name":"django"
      }
   ]
}

Currently I manged to do it changing on serializers:

value = [{ 'id':tag.id, 'name': tag.name } for tag in value.all()]

@glemmaPaul
Copy link
Owner

In my opinion returning the "id" back in the response removes the whole idea of tags in the first place. I could understand it when you have some sort of "slug" that correspondents to it.

But, that's definitely a opinion we could accomplish. I think there is going to be a new version where you can add parsers and renderers, so you could do it yourself 👍 !

Anyways, thank you for creating this issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants