Re: How to parse json and display it in CBV.

2017-12-28 Thread tango ward
Thanks James. I heard of serialization in REST but I haven't played around with it. That's why I didn't know the exact terms of what I am doing. On Thu, Dec 28, 2017 at 5:44 AM, James Schneider wrote: > > > On Dec 27, 2017 1:02 PM, "tango ward" wrote: > > Follow up question. Apologies for the

Re: How to parse json and display it in CBV.

2017-12-27 Thread James Schneider
On Dec 27, 2017 1:02 PM, "tango ward" wrote: Follow up question. Apologies for the continuation. I tried integrating the API from OpenDOTA https://api.opendota.com/api/h eroes. my code: import requests import json url = requests.get('https://api.opendota.com/api/heroes') res = url.json() whe

Re: How to parse json and display it in CBV.

2017-12-27 Thread tango ward
Follow up question. Apologies for the continuation. I tried integrating the API from OpenDOTA https://api.opendota.com/api/heroes. my code: import requests import json url = requests.get('https://api.opendota.com/api/heroes') res = url.json() when I typed in 'res' in my terminal, it returns a

Re: How to parse json and display it in CBV.

2017-12-26 Thread tango ward
Thanks for the idea Andréas. You're always helping me. On Wed, Dec 27, 2017 at 2:29 AM, Andréas Kühne wrote: > All you need is to send the image (the url to the image) that should be > shown to the template, and then display it on the template. It shouldn't be > too hard as long as you understan

Re: How to parse json and display it in CBV.

2017-12-26 Thread Andréas Kühne
All you need is to send the image (the url to the image) that should be shown to the template, and then display it on the template. It shouldn't be too hard as long as you understand how to send context data to the template. See here : https://docs.djangoproject.com/en/2.0/topics/class-based-views

Re: How to parse json and display it in CBV.

2017-12-26 Thread tango ward
Hi Andréas, Thanks for the help. Also, I am not sure if the correct term is parse but I also want to display the images of heroes of DOTA 2 from OpenDOTA API. I saw a video on youtube on how to do it however its in Swift. Not sure if I can do it using CBV in django. On Wed, Dec 27, 2017 at 1:56

Re: How to parse json and display it in CBV.

2017-12-26 Thread Andréas Kühne
Hi, If you want to parse json in django - or in python for that matter - all you have to do is to use the json module. import json object = json.loads(insert_string_here) insert_string_here is the string that you want to parse - and object is the parsed json. Look here for more information: ht

How to parse json and display it in CBV.

2017-12-26 Thread tango ward
Hi, I need suggestions on this. I want to use the OpenDOTA API for my pet project. As a beginner, I don't know where to start working on this. I have found the OpenDOTA API https://api.opendota.com/api/heroes which I am planning to use but I am confuse as to how to parse the json into my CBVs. I