I feel you, figuring out such errors for the first time can be infinitely 
frustrating.

I believe that the form is sending you product id numbers as strings, or 1 as 
‘1’. 

If the product_id = ‘1’ then product_id is not None.

However, you have defined product_id in the model for Product as an int and 
it’s raising a TypeError because you’re searching for a product_id that is a 
string instead.

To fix the problem, convert the result from the POST request from a string into 
an int.

After you check if product_id is not None:
    product_id = int(product_id)

Regards,
Alejandro Peña

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ccf02f4-9d1c-4363-85cc-feb39b5326e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to