if you just want to put that into json do:
import json

YEAR_IN_SCHOOL_CHOICES = (
    ('FR', 'Freshman'),
    ('SO', 'Sophomore'),
    ('JR', 'Junior'),
    ('SR', 'Senior'),
)

serialized_year_choices = json.dumps(Model.YEAR_IN_SCHOOL_CHOICES) 





On Thursday, May 17, 2018 at 10:52:15 AM UTC-4, Majid Hojati wrote:
>
> Hi,
> I have a Field.choices in my model. lets say it is:
>
> YEAR_IN_SCHOOL_CHOICES = (
>> ('FR', 'Freshman'),
>> ('SO', 'Sophomore'),
>> ('JR', 'Junior'),
>> ('SR', 'Senior'),
>> )
>
>
> I can access them using this method Model. YEAR_IN_SCHOOL_CHOICES  but 
> how can I convert it to a json then I can send them using a webservice ? is 
> there any good method?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3ebbf6ad-9d34-44ec-8274-983cb5a5fa97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to