Git Product home page Git Product logo

Comments (2)

Sarthak77tiwari avatar Sarthak77tiwari commented on May 21, 2024

I have model Shop, Product, Customer, Order. the relation of model
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)`

customer
`
class Customer(models.Model):

          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
`
class Product(models.Model):

           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
`
class Order(models.Model):
STATUS = (
('Pending', 'Pending'),
('Out for delivery', 'Out for delivery'),
('Delivered', 'Delivered'),
)
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')`
when customers login then the list of shops 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 an order so that the customer in order is the instance and the shop in order is that shop which is selected to show the products, and products which are selected for the order, please explain me

from django-ecommerce.

mattfreire avatar mattfreire commented on May 21, 2024

Please consider posting questions like this on StackOverflow. Issues are to keep track of issues

from django-ecommerce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.