Thursday, August 26, 2021

Re: UML to Django models

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)

On Thursday, 26 August 2021 at 16:14:04 UTC+1 abubak...@gmail.com wrote:
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?

On Thu, Aug 26, 2021 at 6:50 PM Derek <game...@gmail.com> wrote:
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.

On Thursday, 26 August 2021 at 10:28:23 UTC+2 abubak...@gmail.com wrote:
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.

--
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.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dbc1bde9-06d9-440d-95ea-1c9c55d1c698n%40googlegroups.com.

No comments:

Post a Comment