Creates diagrams from code and sometimes vice versa. Primary use cases:
- Generate object models from Django models
- Generate even flow diagram from code regexes
Diagram layout is autogenerated.
Just used by me. I'd be happy to clean up the code and generalize it if there's interest.
class TestType(models.Model):
OS_TYPES_LIST = ["Windows", "Mac", "Ubuntu"]
os_types_max_len, OS_TYPES, OS_TYPES_CHOICES = model_utils.convert_to_choices(OS_TYPES_LIST)
OS_VERSION_LIST = ["7", "XP", "Vista", "X.4", "X.5", "X.6", "8.04", "9.06"]
os_version_max_len, OS_VERSION, OS_VERSION_CHOICES = model_utils.convert_to_choices(OS_VERSION_LIST)
FF_VERSION_LIST = ["3.0", "3.5", "3.6"]
ff_max_len, FF_VERSION, FF_VERSION_CHOICES = model_utils.convert_to_choices(FF_VERSION_LIST)
slug = models.CharField(max_length=200)
name = models.CharField(max_length=200)
os_type = models.CharField(max_length=os_types_max_len, choices=OS_TYPES_CHOICES)
os_version = models.CharField(max_length=os_version_max_len, choices=OS_VERSION_CHOICES)
ff_version = models.CharField(max_length=ff_max_len, choices=FF_VERSION_CHOICES)
...
class TestRun(models.Model):
test_type = models.ForeignKey(TestType)
dtime = models.DateTimeField(db_index=True)
is_pass = models.BooleanField(default=False)
number_fail = models.IntegerField(default=-1)
total = models.IntegerField(default=-1)
duration = models.IntegerField(default=-1)
...
class TestType(models.Model):
id = models.AutoField()
slug = models.CharField(max_length=200)
name = models.CharField(max_length=200)
os_type = models.CharField(max_length=200)
os_version = models.CharField(max_length=200)
ff_version = models.CharField(max_length=200)
class TestRun(models.Model):
id = models.AutoField()
test_type = models.ForeignKey('TestType')
dtime = models.DateTimeField()
is_pass = models.BooleanField()
number_fail = models.IntegerField()
total = models.IntegerField()
duration = models.IntegerField()
DOT/Graphviz
OmniGraffle
-
Mac-only software
-
requires OmniGraffle
-
requires appscript, python library for AppleScript sudo easy_install appscript
-
http://appscript.sourceforge.net/py-appscript/doc/
sudo easy_install appscript
Django
Command line interface:
- cd to Auto-Models root
- edit config.py
python main.py ef2dot
- cd to <Django project (or some directory inside project)>
python <path to Auto-Models>/main.py help
When creating OmniGraffle diagrams, the script does a force-directed layout on the models.