1๐
โ
You have problem with this piece of code in your view.
Following.objects.get(follow_to=follow_to)
Here the follow_to
parameter passed to view is string and from the url mentioned it seems it is 'n'
. But you are searching for foreign key which will search for id
of an object. id
is integer.
So in the query its trying to convert 'n'
into int
to search appropriate object. But the conversion fails.
You need to either check for that and/or use id
related regex in url for follow_to
parameter.
๐คRohan
1๐
If the django.contrib.auth.models.User
model is used, its pk
is an integer. However, the url pattern matches any word character (\w
). Thus if only numbers should be allowed, modifying urls.py
to only allow integer id matches might be a solution.
url(r'^followed/(?P<follow_to>\d+)/$', followed, name='followed'),
๐คzsepi
- [Answered ]-Django Channels: How to flush send buffer
- [Answered ]-How I can display one field as string from serializer?
- [Answered ]-Is it possible for a function to reference the class on which it's called?
- [Answered ]-Get Celery logs in the same place as 'normal' Django logs and formatted by a Django formatter
Source:stackexchange.com