Closed khatchad closed 3 years ago
@mZneit I fixed this issue but in the process I broke the categorizations view. Do you know:
search
function is, andIt seems that this function is called any time a query parameter is being used. If that's the case, different views can use query parameters. We can't have it only work for a single view. The way I see it, we need to either:
I had a look at the search() code I removed in more detail. It seems very tied to the categorizations view. The add route is not meant to be a view but rather an insertion form (the route should really be called new instead of add). Either way, I am having trouble understanding why this function is being called in this context.
The search function filters the categorization based on the user ID. I should have called it filter_categorizations or a similar name.
Is this something specific to our app or standard for Django?
It's being called for the categorizations insertion route. Cannot insertion routes have query parameters? Or, is there something forcing routes with query parameters to go to this function?
It's the view that directs to this page https://fathomless-inlet-57767.herokuapp.com/ponder/categorizations?user=14 and filters the categorizations. I'm not sure why it's showing up in the error message.
Also, search what? Categorizations? Bug fixes?
I meant by it to search for the Categorizations for a logged in user with a specific ID. But I know it should have a better name.
Ok I see it in urls.py
.
the problem is with the path?
I think the problem is the way I wrote the URL and rendered the page. It should be more robust.
I reverted the changes in search()
, which fixes the categorization view. I also moved up the route for add()
, so that function doesn't get called. However, I am getting an error now with a missing pk
variable.
else: return HttpResponse('
is missing from the search method I believe.
the problem is with the path?
It's fixed now. Thanks.
I meant by it to search for the Categorizations for a logged in user with a specific ID. But I know it should have a better name.
Yes. Please see #80.
Ok will work on that.
The URL that brings me to add a categorization, for example, is
https://fathomless-inlet-57767.herokuapp.com/ponder/categorizations/add%3Fcommit=00d519bb222601f8a264c4abe311757e5079e03f
. My understanding is that%3F
is?
. However, if I replace%3F
with?
in the URL, i.e.,https://fathomless-inlet-57767.herokuapp.com/ponder/categorizations/add?commit=00d519bb222601f8a264c4abe311757e5079e03f
, I get aMultiValueDictKeyError
exception. My understanding is that the behavior should be the same (and also we should never have exceptions surface to the user):