GithubHelp home page GithubHelp logo

Export graph data about django-schema-graph HOT 2 OPEN

meshy avatar meshy commented on August 14, 2024
Export graph data

from django-schema-graph.

Comments (2)

rotten avatar rotten commented on August 14, 2024

FWIW, I was able to grab the raw graph data this tool generates by using the wget command found in issue #49: #49 (comment) and then editing the index.html, and then post-processing it to a format gephi could use. It was more manual work than I had planned, which is why I thought it might make a nice feature.

from django-schema-graph.

meshy avatar meshy commented on August 14, 2024

It should be possible to create a view that returns the data in a format you like by taking inspiration from the existing view:

def get_context_data(self, **kwargs):
schema = get_schema()
json_converter = make_json_converter()
kwargs["schema"] = json_converter.dumps(schema)
return super().get_context_data(**kwargs)

In your case, I think you'll want something like:

from cattrs.preconf.json import make_converter as make_json_converter
from django.http import HttpResponse

from schema_graph.schema import get_schema


def schema_json(request):
     schema = get_schema()
     json_converter = make_json_converter()
     schema_json = json_converter.dumps(schema)
     return HttpResponse(schema_json, content_type="application/json")

This example returns the graph data as JSON, but if you want another format you should be able to do that in the view.

from django-schema-graph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.