All Unkept
Posted in: Django  —  25 November 2005

Django dreaming

Remembering the Don't Repeat Yourself mantra, the following apps would be awesome:

  • An app that generates a large part of the spec for data-driven applications (i.e. the bit describing all the tables of data) directly from the Django db models defined in Python.
  • Similarly, an app that generates UML diagrams from your Django models.

With these in place, part of the functional requirements gathering would be done by writing Python directly. You might have to fix it up a bit to remove syntax errors, but then a few quick commands later and you'd find you had:

  • half your spec written
  • some pretty UML pictures for management (and a useful reference for developers, of course :-)
  • the database structure created
  • your data layer written for you by Django's ORM
  • a working admin interface
  • and a massive headstart on development.

And all this before you come back from talking with the customer! Implementing these apps would be a lot of fun, but I can't justify the time at the moment, seeing as I'm not using Django for any projects like the above. But I can dream...

Comments §

§ On 27 November 2005, radek wrote: 37
Hi,

for the first app I believe you can use django-admin.py sql ...

for the second one, AFAIK SPE IDE generates UML diags based on the Python code. However I have not tested that with Django models.

§ On 27 November 2005, Eric Moritz wrote: 38
Last I check, ArgoUML has a good code export plugin system to create code from UML models. That is if you want to program in Java again. You could probably use Jython to create the plugin :)

§ On 28 November 2005, radek wrote: 39
ArgoUML - yes, that is what we have been discussing in this ticket: http://code.djangoproject.com/ticket/854

§ On 28 November 2005, luke wrote: 40
For the first app, I meant something that will just write out some tables describing tables, in some format that can be included in a spec document (e.g. latex, pdf or something).

For the second, I want Django model -> UML, rather than UML -> Django (I prefer Python as the authoritative source, not some diagram that needs a graphical viewer to make sense of it). So something like the SPE IDE sounds good for the second, but ArgoUML is the wrong way round for my preference.

§ On 18 February 2006, luke wrote: 50
For those interested, I found a reasonably good way to do this:

After creating your models in Python, create the database using the django-admin tool, then use postgresql-autodoc to create diagrams from the database (assuming you are using postgres - if not, it's free and easy to use, and you could create the tables just for the purpose of creating the diagram). It doesn't automatically lay it out nicely for you, but you can use 'Dia' to do that.

§ On 6 August 2006, luke wrote: 85
Further update - someone has now implemented a lot of this:

http://code.djangoproject.com/wiki/DjangoGraphviz

§ On 29 September 2006, Antonio Cavedoni wrote: 133
Further further update: that someone is me ;-)

Kidding aside, I haven’t had much time to update that script after the release, so contributions and ideas are welcome!

§ On 29 September 2006, luke wrote: 135
Hmm, my blog software sucks - your apostrophe came out pretty badly there. I should have used Django!

§ On 9 February 2010, asd asd wrote: 849

§ On 21 July 2010, luke wrote: 923

See also graph_models from django-command-extensions - http://code.google.com/p/django-command-extensions/wiki/GraphModels


Add comment

Format:

  • Javascript has to be on to get past my spam protection, and cookies, and there is a delay, sorry for any inconvenience!
  • I reserve the right to moderate comments.