invalid literal for int() with base 10: ''

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

views.py.png (690K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

anchal agarwal

Hello lutalo
I am also facing the same issue. If you find any solution please let me know . It would be very helpful.
Thank you

hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMT%3DisUkQszjKE0GjvQsi5czm77wbfjd906w8kepKd4nXFv--Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

aishtiaque
In reply to this post by Lutalo Bbosa joseph
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DSg%3DA_C_7jwFxXKZn_9qMV-qRxXTgjZJUMRnK2wC_gYsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

remove.png (383K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DT-Gp4AYzdaL_otXru--naTAoQErJbzQxCSiS4a0Tn2iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
i as well have a models.py file for carts, and products which is attached, when i try to search for a solution on stack overflow,all solutions insist on problem with integers and strings in my code. though these were passed solutions and not too similar to this one

On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph <[hidden email]> wrote:
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

cart_models.png (567K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Aldian Fazrihady
Does the stack trace mention a template variable name?  It looks like a template variable that is expected to have integer value is not properly initialized.

Regards, 

Aldian Fazrihady

On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, <[hidden email]> wrote:
i as well have a models.py file for carts, and products which is attached, when i try to search for a solution on stack overflow,all solutions insist on problem with integers and strings in my code. though these were passed solutions and not too similar to this one

On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph <[hidden email]> wrote:
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
here is my template that handles that bit, and i have as well attached atemplate in which its used

On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady <[hidden email]> wrote:
Does the stack trace mention a template variable name?  It looks like a template variable that is expected to have integer value is not properly initialized.

Regards, 

Aldian Fazrihady

On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, <[hidden email]> wrote:
i as well have a models.py file for carts, and products which is attached, when i try to search for a solution on stack overflow,all solutions insist on problem with integers and strings in my code. though these were passed solutions and not too similar to this one

On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph <[hidden email]> wrote:
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DQ39LSikG6aFL4PGuppSy2eOjKkEVqDJTVeRZOvEBFE0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

update_cart.png (407K) Download Attachment
template.png (417K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Jorge Gimeno
Would you be able to copy and paste the stack trace here? Without that, it's really hard to see where this exception is coming from.

-Jorge

On Fri, Jun 21, 2019 at 9:13 AM Lutalo Bbosa joseph <[hidden email]> wrote:
here is my template that handles that bit, and i have as well attached atemplate in which its used

On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady <[hidden email]> wrote:
Does the stack trace mention a template variable name?  It looks like a template variable that is expected to have integer value is not properly initialized.

Regards, 

Aldian Fazrihady

On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, <[hidden email]> wrote:
i as well have a models.py file for carts, and products which is attached, when i try to search for a solution on stack overflow,all solutions insist on problem with integers and strings in my code. though these were passed solutions and not too similar to this one

On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph <[hidden email]> wrote:
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DQ39LSikG6aFL4PGuppSy2eOjKkEVqDJTVeRZOvEBFE0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CANfN%3DK_%3D3HTrTFXtCDKBOmUAF78fby3nOoBJei8-1kSfaVRNeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Héctor Alonso Lozada Echezuría
In reply to this post by Lutalo Bbosa joseph
Apparently product_id has no value

product_id = request.POST.get("product_id")
print(product_id)
print(type(product_id))


El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph (<[hidden email]>) escribió:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Héctor Alonso Lozada Echezurí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 [hidden email].
To post to this group, send email to [hidden email].
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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
In reply to this post by Jorge Gimeno

ValueError at /carts/update/

invalid literal for int() with base 10: '' thats the error


On Fri, Jun 21, 2019 at 7:46 PM Jorge Gimeno <[hidden email]> wrote:
Would you be able to copy and paste the stack trace here? Without that, it's really hard to see where this exception is coming from.

-Jorge

On Fri, Jun 21, 2019 at 9:13 AM Lutalo Bbosa joseph <[hidden email]> wrote:
here is my template that handles that bit, and i have as well attached atemplate in which its used

On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady <[hidden email]> wrote:
Does the stack trace mention a template variable name?  It looks like a template variable that is expected to have integer value is not properly initialized.

Regards, 

Aldian Fazrihady

On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, <[hidden email]> wrote:
i as well have a models.py file for carts, and products which is attached, when i try to search for a solution on stack overflow,all solutions insist on problem with integers and strings in my code. though these were passed solutions and not too similar to this one

On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph <[hidden email]> wrote:
on pressing remove the product is supposed to be removed from the cart, but it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph <[hidden email]> wrote:
well here is apic of what am doing,

On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <[hidden email]> wrote:
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It would help us decipher what's really going on in relation to what you're trying to do. 

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <[hidden email]> wrote:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DQ39LSikG6aFL4PGuppSy2eOjKkEVqDJTVeRZOvEBFE0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CANfN%3DK_%3D3HTrTFXtCDKBOmUAF78fby3nOoBJei8-1kSfaVRNeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DRW4u5tLZKusnzb9Wyu8xu93wUrzxN4n2K39TvijH5u-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
In reply to this post by Héctor Alonso Lozada Echezuría
hi hector, can u help me fix it, coz am kinda puzzled




On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <[hidden email]> wrote:
Apparently product_id has no value

product_id = request.POST.get("product_id")
print(product_id)
print(type(product_id))


El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph (<[hidden email]>) escribió:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Héctor Alonso Lozada Echezurí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 [hidden email].
To post to this group, send email to [hidden email].
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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTYjC9WSGBsTyzfW7%2BBbq6a2cD0H%3DsdXgrnM6gyPhf30Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
am trying to figure it out but when i
print(product_id)
print(type(product_id)) i get this output
1
<class 'str'>, so probably its because i cant iterate over a string but am still failing to figure it out


On Fri, Jun 21, 2019 at 10:16 PM Lutalo Bbosa joseph <[hidden email]> wrote:
hi hector, can u help me fix it, coz am kinda puzzled




On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <[hidden email]> wrote:
Apparently product_id has no value

product_id = request.POST.get("product_id")
print(product_id)
print(type(product_id))


El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph (<[hidden email]>) escribió:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Héctor Alonso Lozada Echezurí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 [hidden email].
To post to this group, send email to [hidden email].
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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR2YMJitLizXQg2_a8tyTUF2%2B46im%2B4MvoGyzyHQayrCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Héctor Alonso Lozada Echezuría
Of course, 

Share your source code and stack trace through pastebin



El vie., 21 jun. 2019 a las 13:34, Lutalo Bbosa joseph (<[hidden email]>) escribió:
am trying to figure it out but when i
print(product_id)
print(type(product_id)) i get this output
1
<class 'str'>, so probably its because i cant iterate over a string but am still failing to figure it out


On Fri, Jun 21, 2019 at 10:16 PM Lutalo Bbosa joseph <[hidden email]> wrote:
hi hector, can u help me fix it, coz am kinda puzzled




On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <[hidden email]> wrote:
Apparently product_id has no value

product_id = request.POST.get("product_id")
print(product_id)
print(type(product_id))


El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph (<[hidden email]>) escribió:
hi guys, am working on an ecommerce system, which has cart as an app, but i keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 42

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Héctor Alonso Lozada Echezurí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 [hidden email].
To post to this group, send email to [hidden email].
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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DR2YMJitLizXQg2_a8tyTUF2%2B46im%2B4MvoGyzyHQayrCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Héctor Alonso Lozada Echezurí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 [hidden email].
To post to this group, send email to [hidden email].
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/CADTS2YwVg4%3D3brJr%2BZFxxbM-fBn_vkWHGQno%3DDyyfHij6atpaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Amiya Dash
In reply to this post by Lutalo Bbosa joseph
Can u send me the full project.share me the github link

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/ec4e7699-f6a0-4689-9611-fb005db3727b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Alejandro Pena
In reply to this post by Lutalo Bbosa joseph
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 [hidden email].
To post to this group, send email to [hidden email].
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 | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
In reply to this post by Amiya Dash
kk will do that,

On Sat, Jun 22, 2019 at 7:29 PM Amiya Dash <[hidden email]> wrote:
Can u send me the full project.share me the github link

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/ec4e7699-f6a0-4689-9611-fb005db3727b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DT%3Dqm94mK4eSw2CziF%3Dv_c6JB9Rb7YTX0nF8%2BvuK5CaTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
In reply to this post by Alejandro Pena
This is what happens in the terminal when i use int(product_id)
2
<class 'str'>
2
[22/Jun/2019 16:56:33] "POST /carts/update/ HTTP/1.1" 302 0
[22/Jun/2019 16:56:33] "GET /carts/ HTTP/1.1" 200 8245



On Sat, Jun 22, 2019 at 7:50 PM Alejandro Pena <[hidden email]> wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DS_e2UFY5EZCgZ32epGiSYTk1d-4ziu-nHv2Q-HphYEBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Alejandro Pena
Sweet, looks like your code is working!

You’re still seeing the ‘2’ and that the type of product_id is a string because your print statements are placed before you convert product_id into an int and then use it to search for product_obj.

The evidence that it’s working is that it didn’t raise an error this time and then you see the POST and GET requests successfully completed with response codes 302 (return redirect to /carts) and 200 (return render...).

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/cf4d348f-9955-43f4-81b9-a4cbc98bb8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: invalid literal for int() with base 10: ''

Lutalo Bbosa joseph
but the remove function is supposed to work yet it returns the error but add works
def update(request):
product_id = request.POST.get("product_id")
    if product_id is not None :
        print(product_id)
        product_id = int(product_id)
       
        try:
            product_id = int(product_id)
            product_obj = Product.objects.get(id=product_id)
            #product_obj = Product.objects.get(id=product_id)
        except Product.DoesNotExist:
            print("message to user, product is gone")
            return redirect("carts:home")
        cart_obj, new_obj = Cart.objects.new_or_get(request)
        if product_obj in cart_obj.products.all():
            cart_obj.products.remove(product_obj)
            added = False

On Sat, Jun 22, 2019 at 8:18 PM Alejandro Pena <[hidden email]> wrote:
Sweet, looks like your code is working!

You’re still seeing the ‘2’ and that the type of product_id is a string because your print statements are placed before you convert product_id into an int and then use it to search for product_obj.

The evidence that it’s working is that it didn’t raise an error this time and then you see the POST and GET requests successfully completed with response codes 302 (return redirect to /carts) and 200 (return render...).

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/cf4d348f-9955-43f4-81b9-a4cbc98bb8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMz%3Dh%3DRdP2F4sB39ad%2B-r5UQvtobBEoAAmrseW0E0aQtOgUWxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
12