Hello,

There are many ways to do it.

1) If you are using postgresql, the TYPE of "type" can be set to json
(postgres dialects) and it can save arrays and dictionaries.

2) you can form an Array, and serialize it before dumping it in the
database, and jsonify the string you retrieved from the database and send
an array in response.

Corrections welcomed.

Thank You.


On Wed, Jul 22, 2015 at 1:23 AM, Maruti Nandan <nandans...@gmail.com> wrote:

> I am a newbie to django.I am designing a rest ful  api. In my response I
> am getting something like this
>
> { "id":"1" , " type ": "thin,tall,round", " "name": " foo" }
>
> But I want something like this
>
> { "id":"1" , " type ": ["thin","tall","round"] , " "name": " foo" }
>
> What model field type should I use to achieve this or any other approach.
> This may be very small query. But it will help me a lot
>
> _______________________________________________
> Chennaipy mailing list
> Chennaipy@python.org
> https://mail.python.org/mailman/listinfo/chennaipy
>
>
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy

Reply via email to