How to use Graphviz/Networkx in django?

206 views
Skip to first unread message

shaw...@gmail.com

unread,
Apr 5, 2018, 2:10:09 PM4/5/18
to Django users
Hi everyone,
If I have three models and I successfully displayed the data using templates and views, how can I use graphviz or networkx to draw graph using the data that I displayed?

Christian Ledermann

unread,
Apr 6, 2018, 4:04:31 AM4/6/18
to django...@googlegroups.com
https://django-extensions.readthedocs.io/en/latest/graph_models.html
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

shaw...@gmail.com

unread,
Apr 6, 2018, 11:30:54 AM4/6/18
to Django users

Hi, thank you for your help.
But I think this link cannot really solve my problem. My question is actually how to visualize the data of my model, rather than visualize the model. 

The situation is, As you can see, the Formula detail table include the reactants that participates in the reaction, now I want to add a function to this page, like add a button at the right side. And when I click on the button, a graph could be generated automatically. The graph should looks like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this function should be done by using Graphviz and Networkx, but how?

在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:

Jani Tiainen

unread,
Apr 6, 2018, 1:39:43 PM4/6/18
to django...@googlegroups.com
Hi,

It's relatively simple. Just generate proper input file for graphwiz or networkx to consume call that tool for input file and create output file. Then render output file via view to your page.


shaw...@gmail.com

unread,
Apr 6, 2018, 2:16:47 PM4/6/18
to Django users
Thanks a lot for your help!
But since the data that needed to be visualized is already shown in the page, generate input file is actually not necessary. In that case, what should I do to make django aware that the data shown in the page is the 'input' how can I call the tool to process the visualization?
I am sorry to ask the stupid question.....I am new to django and I am really hope you could help me!
Thanks

在 2018年4月6日星期五 UTC+2下午7:39:43,Jani Tiainen写道:

Jani Tiainen

unread,
Apr 7, 2018, 2:41:45 AM4/7/18
to django...@googlegroups.com
Hi,

You could take a look at django-extensions how it generates graphs from models as an inspiration.

Reply all
Reply to author
Forward
0 new messages