Skip to content

Commit

Permalink
Update Makefile + add vis runscript
Browse files Browse the repository at this point in the history
  • Loading branch information
theognis1002 committed Sep 10, 2022
1 parent 026e9b4 commit 3f26625
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
shell_plus:
shell_plus sp:
python manage.py shell_plus

migration_visualizer viz:
python manage.py runscript visualize

clean:
find . -name 'migration-dep*' -exec rm {} \;
6 changes: 6 additions & 0 deletions scripts/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from utils.visualizer import MigrationVisualizer


def run():
v = MigrationVisualizer(output_format="jpg")
print(v)
4 changes: 2 additions & 2 deletions utils/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def build_graph(self):


class MigrationVisualizer:
def __init__(self, *apps, **options):
def __init__(self, *apps, output_format=None, **options):
self._censor_cache = {}
self._censor_enabled = bool(options.get("censor", False))
if self._censor_enabled:
Expand All @@ -130,7 +130,7 @@ def __init__(self, *apps, **options):
date=options.get("date", datetime.utcnow()), # TODO: use no connection?
).graph
comment = options.get("comment")
self.picture = Digraph(comment=comment)
self.picture = Digraph(comment=comment, format=output_format)
save_loc = options.get("filename", "migration-dep-tree")
self._render(save_loc)

Expand Down

0 comments on commit 3f26625

Please sign in to comment.