Where use JSON in Django?

40 views
Skip to first unread message

Hayk Manukyan

unread,
Feb 13, 2018, 11:54:09 AM2/13/18
to Django users
Maybe my question is stupid but I want understand where and why developer need use json.
project on github this is my project. In templates used django tags.
Have to need project changes for example from ({% for product in products %}<some HTML>{{ product }}<some HTML>{% endfor %}) to json?
Thank you for your time

M Hashmi

unread,
Feb 13, 2018, 1:36:27 PM2/13/18
to django...@googlegroups.com
JSON is parsing in and out information from JS to Python or Django in your case directly. For instance let's suppose you have a JS script in your template and you need to pass your context variables into JS code as variables. You can jsonify your request/response to get or post data. 

A good example would be charts, lets suppose you need to show the number of student per class in any project and you want to visually project the quantity. In that case you need to parse your Student model to JS charting scripts. That is where you create JSON request/response objects to supply or capture the events.

Please check this out an try the following link for practice:


Regards,

Mudassar



--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hayk Manukyan

unread,
Feb 14, 2018, 9:23:56 AM2/14/18
to Django users
Ok Thank You

вторник, 13 февраля 2018 г., 19:36:27 UTC+1 пользователь M Hashmi написал:
JSON is parsing in and out information from JS to Python or Django in your case directly. For instance let's suppose you have a JS script in your template and you need to pass your context variables into JS code as variables. You can jsonify your request/response to get or post data. 

A good example would be charts, lets suppose you need to show the number of student per class in any project and you want to visually project the quantity. In that case you need to parse your Student model to JS charting scripts. That is where you create JSON request/response objects to supply or capture the events.

Please check this out an try the following link for practice:


Regards,

Mudassar


On Tue, Feb 13, 2018 at 7:08 AM, Hayk Manukyan <hayk...@gmail.com> wrote:
Maybe my question is stupid but I want understand where and why developer need use json.
project on github this is my project. In templates used django tags.
Have to need project changes for example from ({% for product in products %}<some HTML>{{ product }}<some HTML>{% endfor %}) to json?
Thank you for your time

--
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.
Reply all
Reply to author
Forward
0 new messages