At the moment creating models.py is only achieved via models.py , dia2django lets you create a models.py from a UML dia file.
When you are creating a project that at the very beginning has a lot of tables and you want to have in mind the model having the opportunity to share it with your coleagues dia2django can help.
Dia2django is not intended to be used as a syncing tool on your visual approach and your actual models.py.
A dia model like :
generates the following code :
fromdjango.contrib.flatpages.modelsimport * classInteresesVisita(models.Model) : nombre = models.CharField(max_length=100) def__str__(self): return "" def__unicode__(self): return u"" classFormulario(models.Model) : ip = models.IPAddressField() fecha = models.DatTimeField() comentarios = models.CharField(max_length=2000, blank=True,null=True ) def__str__(self): return "" def__unicode__(self): return u"" classFormularioSocial(Formulario) : nombrepersona = models.CharField(max_length=150) correopersona = models.EmailField() cargo = models.CharField(max_length=100) nombreinst = models.CharField(max_length=200) nombremaximo = models.CharField(max_length=150) telefonos = models.CharField(max_length=300) direccion = models.CharField(max_length=300) fax = models.CharField(max_length=200, null=True,blank=True ) correoinst = models.CharField(max_length=200, null=True,blank=True ) pagina = models.CharField(max_length=300, null=True,blank=True ) def__str__(self): return "" def__unicode__(self): return u"" classSeccion(models.Model) : nombre = models.CharField(max_length=30) alt = models.CharField(max_length=100) pagina = models.ForeignKey(FlatPage,null=True) url = models.CharField(max_length=100, null=True ) def__str__(self): return "" def__unicode__(self): return u"" classCaja(models.Model) : pos = models.IntegerField() nombre = models.CharField(max_length=30) alt = models.CharField(max_length=100, null=True ) peso = models.FloatField(default=0) seccion = models.ForeignKey(Seccion) pagina = models.ForeignKey(FlatPage,null=True) url = models.CharField(max_length=100, null=True ) def__str__(self): return "" def__unicode__(self): return u"" classEnlace(models.Model) : nombre = models.CharField(max_length=30) alt = models.CharField(max_length=100, null=True ) peso = models.FloatField(default=0) caja = models.ForeignKey(Caja) pagina = models.ForeignKey(FlatPage,null=True) url = models.CharField(max_length=100, null=True ) def__str__(self): return "" def__unicode__(self): return u"" classFormularioVisita(Formulario) : nombrepersona = models.CharField(max_length=150) correopersona = models.EmailField() cargo = models.CharField(max_length=100) nombreinst = models.CharField(max_length=200) nombremaximo = models.CharField(max_length=150) expercompu = models.CharField(max_length=300) direccion = models.CharField(max_length=300) telefonos = models.CharField(max_length=300) fax = models.CharField(max_length=200, null=True,blank=True ) correoinst = models.CharField(max_length=200, null=True,blank=True ) pagina = models.CharField(max_length=300, null=True,blank=True ) intereses = models.ManyToManyField(InteresesVisita) def__str__(self): return "" def__unicode__(self): return u"" classFormularioAspirante(Formulario) : nombre = models.CharField(max_length=100) grado = models.IntegerField() telefonos = models.CharField(max_length=150) direccion = models.CharField(max_length=150) acudiente = models.CharField(max_length=200) email = models.EmailField(null=True,blank=True) def__str__(self): return "" def__unicode__(self): return u""
Download dia2code
wget --no-check-certificate https://svn.devnull.li/main/pythonware/dia2django/trunk/src/dia2django.py
How to use dia2code
dia2code yourumldiagram.dia > models.py
Read the instructions.
Last modified
17 years ago
Last modified on Aug 13, 2008, 7:21:49 PM
Attachments (1)
-
web.png
(50.6 KB
) - added by Igor Támara 17 years ago.
Colorized model
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.