Skip to content

how i can create order form #24

@Sarthak77tiwari

Description

@Sarthak77tiwari

please help me
I have four models of the shop, customer, product, an order.
I am showing the relation of models

shop

   user = models.OneToOneField(User, null=True, related_name='shop', blank=True, on_delete=models.CASCADE)
   name = models.CharField(max_length=70, null=True, default='shop', )
   address = models.CharField(max_length=70, null=True)
   Shop_category = models.CharField(max_length=200, null=True, )

customer

  user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
  name = models.CharField(max_length=100, null=True, default='customer')
  Phone = models.PositiveIntegerField(blank=True, null=True)`

product

  shop = models.ForeignKey(Shop, models.CASCADE, null=True, blank=True)
  name = models.CharField(max_length=100, blank=True)
  Brand = models.CharField(max_length=200, blank=True)
  description = models.TextField(null=True, blank=True)

order

  shop = models.ForeignKey(Shop, models.CASCADE, null=True)
  customer = models.ForeignKey(Customer, models.CASCADE, null=True)
  product = models.ForeignKey(Product, models.CASCADE, null=True)
  quantity = models.CharField(max_length=30)
  date_created = models.DateTimeField(auto_now_add=True)
  status = models.CharField(max_length=200, choices=STATUS, default='Pending')
  note = models.CharField(max_length=1000, null=True)`

when customers login then the shop will print on the screen and a button on shop to show the products by the shop in the form card. On the product card, there is an order button that adds the product in order after submitting the selected product will print with the remaining filled of order. how I can create views.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions