

AttributeError: type object 'Product' has no attribute 'object'
> `models.py
>
> from django.db import models
> from django.contrib.auth.models import User
>
> class Product(models.Model):
> title = models.CharField(max_length=100)
> selling_price = models.FloatField()
> discounted_price = models.FloatField()
> description = models.TextField()
> composition = models.TextField(default='')
> prodapp = models.TextField(default= '')
> #brand = models.CharField(max_length=100)
> category = models.CharField(choices=CATEGORY_CHOICES, max_length=2)
> product_image=models.ImageField(upload_to="product")
> def __str__(self):
> return self.title
>
>
>
>
>
> views.py
>
> from django.views import View
> from . models import Product, Cart, Customer
>
> def add_to_cart(request):
> user=request.user
> product_id=request.GET.get('prod_id')
> product = Product.object.get(id=product_id)
> Cart(user=user,product=product).save()
> return redirect("/cart")`
>
>
>
>
> '''
> my error:
>
> File "C:\Users\SIRI\OneDrive\Desktop\E-com\ec\app\views.py", line 107, in add_to_cart
> product = Product.object.get(id=product_id)
> ^^^^^^^^^^^^^^
> AttributeError: type object 'Product' has no attribute 'object'
> [29/Apr/2023 13:08:43] "GET /add-to-cart/?prod_id= HTTP/1.1" 500 67990
> '''
>
>
>
> ```
> I am learner i don't where i did mistake can you please fix it DM me by mail eaglemem78@gmail.com
> ```
> `