Skip to content

Innovators-Hub/E-commerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

E Commerce Project

Problem Statement: Create an Online Shopping Website

Requirements

  • Python
  • Django

It is advised to install django in a virtual mwrapper to keep the files seperate. You can do this by using a virtual environment wrapper. Here's a tutorial about setting up Django & Virtual Wrapper.

Installation

Clone this repo or download the code as zip file and extract it.

Issue

This is the home page of our project: picture alt

If you click on the cart icon on the navbar, it should lead you to the cart system but it displays an error Screenshot (293)

The issue is in the file models.py. Here's a code snippet of class where I feel the problem could be:

class Product(models.Model):
    name = models.CharField(max_length=200)
    price = models.DecimalField(max_digits=7,decimal_places=2)
    digital = models.BooleanField(default=False,null=True, blank=True)  #To check of a product is a virtual  product or physical product.
    image = models.ImageField(null=True, blank=True)
    is_this_a_local_product = models.BooleanField(default=True,null=True, blank=True)  #To check of a product is a virtual  product or physical product.
    
    def __str__(self):
        return self.name
    

    @property
    def imageURL(self):
        try:
            url = self.image.url 
        except:
            url = ''
        return url
        
class OrderItem(models.Model):
    product = models.ForeignKey(Product,on_delete=models.SET_NULL, null=True)
    order = models.ForeignKey(Order,on_delete=models.SET_NULL, null=True)
    quantity = models.IntegerField(default=0, null=True,blank=True)
    date_added = models.DateTimeField(auto_now_add=True)

    @property
    def get_total(self):
        total = self.product.price * self.quantity
        return total

Let me know if you know the solution to this problem. And feel free to explore the code to search the cause of the error. Thank you!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published