Mahantesh,
No.
Think about what you need to do - you need to fetch this JSON in your
view, process it, and then send those variables as "context" to your
template to be able to render them.
So, first, you need to fetch the JSON data in your python view. This
can be accomplished with something like:
import urllib2
json_string = urllib2.urlopen('
http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=O-lzp4Hyqp8&format=json').read()
^ this will store the results of that webpage into a variable called
"json_string". You can also look at the "requests" library to fetch
data from URLs in python, but urllib2 should be fine as well.
Then, we need to convert the json_string into a python dict:
import json
data = json.loads(json_string)
Now you will have a python dict with all the data in a variable called "data"
Now you can process this data, add other context data that you need,
etc. and finally render the template with something like:
from django.shortcuts import render
return render(request, "template_name.html", data)
Then in your template you can output like {{ author_name }}, {{
author_url }}, etc. as needed.
Hope that makes sense.
All the best,
Sanjay
> Thanks in advance
>
>
>
>
>
>
> --
> 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
django-users...@googlegroups.com.
> To post to this group, send email to
django...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/django-users.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/django-users/10216c68-f54f-4ea9-9e9c-6d0d03227bc0%40googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.