ValueError: invalid literal for int() with base 10 when do Django Filter()


Do you got this error while doing filter QuerySet in Django:

1
ValueError: invalid literal for int() with base 10:

It just simply mistake that may you usually do by filter() with args or kwargs.
This is some bad code :

1
2
kwargs = {‘created__year’: 2012, ‘name’: ‘yodi’}
Insurance.objects.filter(kwargs)

No? Still can’t figure out where is the problem?

1
2
kwargs = {‘created__year’: 2012, ‘name’: ‘yodi’}
Insurance.objects.filter(**kwargs)

See the difference? When you got this problem, it’s mean you tired. Get a rest 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.