I'm a newbie to Django-oscar and I'm trying to develop a simple CRUD operation on Product
. I've forked the catalogue app and created a views.py
file
I fired the query Product.objects.create(title='Hello')
and a product does get created with the following error:
AttributeError: 'NoneType' object has no attribute 'attributes'
product_title = 'MyPhone'
upc=987654321
product_class = ProductClass.objects.get_or_create(name='Phone')
def createProduct(request):
line1
product.name = product_title
product.product_class = product_class
product.upc=upc
product.save()
When I put product=Product()
in line1 I get the following error:
Cannot assign "(, False)": "Product.product_class" must be a "ProductClass" instance.
When I put product = Product.objects.create(upc=upc)
I get the following error :
NoneType' object has no attribute 'attributes'
Anyone guide me on how to write a simple create operation?