Where use JSON in Django?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Where use JSON in Django?

Hayk Manukyan
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Where use JSON in Django?

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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CANoUts46R7aS_5e1-un%3DyuLUj4O%3DEmT6KVQShG3oT3oqfuvNDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Where use JSON in Django?

Hayk Manukyan
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:

<a href="https://www.youtube.com/watch?v=B4Vmm3yZPgc" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.youtube.com/watch?v\x3dB4Vmm3yZPgc&#39;;return true;" onclick="this.href=&#39;https://www.youtube.com/watch?v\x3dB4Vmm3yZPgc&#39;;return true;">https://www.youtube.com/watch?v=B4Vmm3yZPgc

Regards,

Mudassar



On Tue, Feb 13, 2018 at 7:08 AM, Hayk Manukyan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="bzDJI8ySBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hayk...@...> wrote:
Maybe my question is stupid but I want understand where and why developer need use json.
<a href="http://hman.pythonanywhere.com/mall/products/none/none/1" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fhman.pythonanywhere.com%2Fmall%2Fproducts%2Fnone%2Fnone%2F1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEAfaSMnszCAtBAyXphmKFyBWVOLg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fhman.pythonanywhere.com%2Fmall%2Fproducts%2Fnone%2Fnone%2F1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEAfaSMnszCAtBAyXphmKFyBWVOLg&#39;;return true;">project on <a href="https://github.com/haykhman/openproject/tree/master" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fhaykhman%2Fopenproject%2Ftree%2Fmaster\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZfhyM185--DqoSdSDreAYGS3sow&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fhaykhman%2Fopenproject%2Ftree%2Fmaster\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZfhyM185--DqoSdSDreAYGS3sow&#39;;return true;">github <a href="http://hamn.pythonanywhere.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fhamn.pythonanywhere.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFssBJ83vD-p3Cv7fLCXGlNqCFJzg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fhamn.pythonanywhere.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFssBJ83vD-p3Cv7fLCXGlNqCFJzg&#39;;return true;"> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="bzDJI8ySBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="bzDJI8ySBwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/deea7478-06c2-40bf-8cfe-738c84611d80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.