[Answered ]-Generating django models from xml

2👍

Here a talk which contains a tutorial to import an xml file as class:

http://youtu.be/sPiWg5jSoZI?t=2h30s

If you run with py3k, (I think this particular demo of this awesome and funny demonstration is compatible with python 2.6 and upper), you’ll get the idea on how to replace your models.py by a models.xml. You’ll have to adapt it to your xml format by yourself.

(you’ll need to look at least from around 2h to 2h32m)

This talk explain a fun way to do it, the speaker doesn’t seem convinced that it’s a great idea.
If you want to generate api models from WSDL, I would suggest you to still make your tables models in hard code as your database isn’t dynamic I suppose. Simply make methods/static methods to translate api models to db models.

Leave a comment