Django: invalid literal for int() with base 10 Django: invalid literal for int() with base 10 django django

Django: invalid literal for int() with base 10


You want to search on the author's author_name field, not the id.

Quote.objects.filter(author__author_name=name)

With your current search, author__exact, Django expects name to be the id of the author, so gives an error because you is not an integer.


aquotelist = Quote.objects.filter(author__author_name__exact = name)

Try changing the corresponding line to the above. The way you have it now, you are matching author to the given name, but author is probably considered by its ID here, definitely not by its author_name. The format is as follows:

Quote.objects.filter([model]__[field]__exact = [whatever])


I think you should reset your migrate , you can see this link :

https://stackoverflow.com/a/54768217/9533909

i hope that help you.