UML to Django models

324 views
Skip to first unread message

DJANGO DEVELOPER

unread,
Aug 26, 2021, 12:32:28 AM8/26/21
to Django users
Currently, I am working on an inventory management system and I have got some UML diagrams and want to convert those uml diagrams into django models. So can anyone guide me on how to convert those UML diagrams into django models?
an example is below of uml diagram
uml.PNG

DJANGO DEVELOPER

unread,
Aug 26, 2021, 4:28:23 AM8/26/21
to Django users
can anyone help me?

On Thu, Aug 26, 2021 at 9:32 AM DJANGO DEVELOPER <abubak...@gmail.com> wrote:
Currently, I am working on an inventory management system and I have got some UML diagrams and want to convert those uml diagrams into django models. So can anyone guide me on how to convert those UML diagrams into django models?
an example is below of uml diagram

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d7cc08c3-cb88-422b-8cb3-a15130abeba1n%40googlegroups.com.

Derek

unread,
Aug 26, 2021, 9:50:52 AM8/26/21
to Django users
There is not sufficient data in that image to create models.  You don't know the field types, for example.

Once you have those, it should not be too hard e.g.:

from django.db import models

class Product(models.Model):
    product_id = models.AutoField()
    name = models.CharField( max_length=255)
    date_introduction = models.DateField()
    comment = models.TextField()

#etc.

You'll need to use ForeignKey fields to link related tables, of course.

HTH.

DJANGO DEVELOPER

unread,
Aug 26, 2021, 11:14:04 AM8/26/21
to Django users
Hi Derek it is not difficult for me to write the model for the product entity. but there are also other diagrams that I want to convert into models. so I was just wanted to clear my concept.
I am confused in Super types and sub types as you can see an entity within the entity. how should I convert them into models?

Cale Roco

unread,
Aug 26, 2021, 11:43:58 AM8/26/21
to Django users
theres a lot of different ways you can do this, depending on your desired functionality, the amount of data you intend to store etc,

// Simple Example
class Product(models.Model):
   name = models.Charfield(max_length=255)


class ProductFeature(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    feature = models.ForeignKey("Feature", on_delete=models.CASCADE)

class Feature(models.Model):
    name = models.CharField(max_length=60)
    value = models.CharField(max_length=60)

DJANGO DEVELOPER

unread,
Aug 26, 2021, 1:01:53 PM8/26/21
to Django users
Hi, Cale thanks for the reply. but in uml diagram Product Feature doesn't have any relation with the product. so why did you made a relation with the product model? can you please guide me on how to do this?

Ahmet Faruk Yılmaz

unread,
Aug 27, 2021, 11:49:42 AM8/27/21
to Django users

I think there are some missing parts on your uml diagram. As Nigel said, Product should have features.
26 Ağustos 2021 Perşembe tarihinde saat 20:01:53 UTC+3 itibarıyla abubak...@gmail.com şunları yazdı:
Reply all
Reply to author
Forward
0 new messages