I'm attempting to design a django application that can help me to handle my litte shop. I must have the ability to make bills within an simpler way than now however i take some assist with the database design.

At this time I've it by doing this:

class Product(models.Model):
  name = models.CharField(max_length=200)
  price = models.IntegerField()

class Article(models.Model):
  product = models.ForeignKey(Producto)
  qty = models.IntegerField()
  id = models.AutoField(primary_key=True)

class Order(models.Model):
  number = models.CharField(max_length=20, primary_key=True)
  client = models.ForeignKey(Client)
  invent = models.ForeignKey(Invent)
  articles = models.ManyToManyField(Article)

I doubt that Product-Article design is congratulations, there must be an additional way to do that because I'll have numerous repeated data during my DB.

Another real question is when the article is "possessed" through the order or maybe the content comes with an to "belong", I don' determine if now you ask , obvious.

EDIT1:

My considered Product-Article:


   +------------------+                   +----------------+       +------------------+

     Product                               Product                  Article      

   ------------------                   ----------------       ------------------

                                                                                 

    Title                                  Title          <--------+ Product         

                                Versus                                               

    Cost                                                                        

                                          Cost                  Qty             

    Qty                                                                          

   +------------------+                   +----------------+       +------------------+

And also the other real question is:


    +------------------+                               +-----------------+      +--------------+

         Order                                          Order        <-------+   Article    

    ------------------                               -----------------      --------------

     Number                 +--------------+                                              

              +------------->  Article               Number                 ...          

     Client    +----------> +--------------+    Versus                                        

                                                    Client                + Order        

     ...                                                                                

                                                    ...                   +--------------+

     Articles + +                                                     

    +------------------+                               +-----------------+

Maybe something similar to this:

class Product(models.Model):
  name = models.CharField(max_length=200)
  current_price = models.IntegerField()

class Order(models.Model):
  number = models.CharField(max_length=20, primary_key=True)
  client = models.ForeignKey(Client)
  invent = models.ForeignKey(Invent)
  total = models.IntegerField()

class Article(models.Model):
  product = models.ForeignKey(Product)
  order = models.ForeignKey(Order)
  qty = models.IntegerField()
  price = models.IntegerField()

Check also this: Extra fields on many-to-many relationships