Sriram, I'm happy to hear that it's been of some help. Some notes are below.
On Fri, Aug 11, 2017 at 04:44:08PM +0100, Sriram Sundar wrote: > Dear Team, > We are using generateDS to create Django model from the xsd and it has > been very helpful. > We have few queries with respect to the generateDS usage listed below, > could you please help us with the same? > 1. While we used '$ ./gends_run_gen_django.py myschema.xsd' to generate > the django model, the generated model seem to have a foreign key reference > for the 'xs:float' type instead of 'models.FloatField'. Can you let us > know if it is an know issue or we are using the library in an incorrect > way. Smells like a bug. I'll take a look. > 2. Once after creating the django model from xsd can generateDS help us > validating and parsing xml inputs to django model directly so that it > could be dumped in to the db. That capability would be quite valuable, I suspect. Let me try to describe it so that we know we are talking about the same thing -- This new capability would enable you to generate modules that contained code that could parse an XML instance document and push the data into a Django model. If we were to try to implement this capability, there are several, alternative approaches that we might follow: 1. Modify generateDS.py -- Add a new command line option, perhaps "--django-import-code". This option would cause generateDS.py to generate an additional method in each generated class. With this new code, you could use the generated module to parse an XML instance document, then call this new method in the root class to recursively walk the tree and push data into the Django model. 2. An alternative, and one that sounds more do-able to me, is to write a new superclass for all the generated classes. Actually, you'd copy the existing superclass, then add a new method that would push the instance data into a Django module. The command line option --xxx=list or --xxx=dict generates information in a class variable in each generated class that might be enough to enable this to work. I'll look into it. But, I doubt that I know enough or understand Django models and database support well enough to do this myself. Perhaps I can write up some notes that would help you do it yourself, or at least help us understand whether this task is feasible and what needs to be done. > 3. The naming convention in the django model seem to add suffix > 'Type_model' to the class name, is there a way for us to get rid ff the > suffix and use the model name same as the xsd element name (like how it is > generated in a python model). This sounds like an enhancement request, and it sounds very reasonable to me. I'll take a look. Thanks for the report and for your comments. I'll be back with more later. Dave -- Dave Kuhlman http://www.davekuhlman.org ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users