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 :

Colorized model

generates the following code :

from django.contrib.flatpages.models import *

class InteresesVisita(models.Model) :
        nombre = models.CharField(max_length=100)

        def __str__(self):
                return ""

        def __unicode__(self):
                return u""


class Formulario(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""


class FormularioSocial(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""


class Seccion(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""


class Caja(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""


class Enlace(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""


class FormularioVisita(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""


class FormularioAspirante(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 16 years ago Last modified on Aug 13, 2008, 7:21:49 PM

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.
Back to Top