0

Am pretty new to Django but I do have long experience in web development. Usually, I always use PowerDesigner to create the table structure of my solution, export to SQL to use as my backend.

With Django its a different story and I was hoping if there is a way I could create my models using PowerDesigner or execute Django to reversely create the models based on the existing backend, Is there such a thing?

Thanks

Mo J. Mughrabi
  • 6,747
  • 16
  • 85
  • 143

3 Answers3

1

Giving up the ORM is giving up much of what makes Django special. If you're looking to handle the database backend yourself, there are other python based web frameworks that let you do this. According to wikipedia, atleast two that are ORM agnostic, cherrypy and pylons.

Johanna Larsson
  • 10,531
  • 6
  • 39
  • 50
  • I don't intend to give up the ORM. I just wish to use a visual tool in the designing phase specially if you dealing with many tables. – Mo J. Mughrabi Nov 26 '10 at 14:36
  • What you'd need then is a visual tool for designing Django models, really. Although not exactly what you described, you can generate images of the database relationships through graphviz or django-extensions. http://code.djangoproject.com/wiki/DjangoGraphviz – Johanna Larsson Nov 26 '10 at 17:42
1

You can do this: just create your tables as you normally would, then run ./manage.py inspectdb > models.py to create the models based on the existing syntax.

Note though that there are some restrictions on what Django can use: in particular, it doesn't support composite primary keys. In practice this shouldn't be much of a problem.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0

I might be too late to the party but this is one of the first links returned in search so I'll answer anywhere. For visual tools to design Django models and generate relevant models.py scripts, django-builder by mmcardle offers a rather convenient tool of doing it here. One can fill up forms for each model and the tool generates corresponding scripts (models, views, forms, urls, tests and even templates). It might not be exactly what you need (especially with its lack of PowerDesigner-like GUI) but it should be close enough. It is also potentially a good project to fork it and add a PowerDesigner-like interface on top.