I have the following django URL:
url(r'^companies/$', 'companies', name='companies'),
If I go to http://localhost:8000/companies/
it works perfectly. However, if I try adding any GET variables to the URL django raises a 404. For example, if I go to http://localhost:8000/companies/?c=1
django raises a 404. What's strange, is that on the 404 it says:
The current URL,
companies/
, didn't match any of these.
Why am I not able to pass GET variables to my URLs?
I am using django 1.4.
The companies view is defined like:
def companies(request):
It shouldn't have to accept any additional parameters because they are GET variables, not URL parameters- correct? I swear I've done this hundreds of times and it always just works...
Okay. Figured out what was causing this very strange behavior. I have a custom context processor that is calling resolve(request.get_full_path())
. Apparently that causes a 404 if there are any GET variables in the URL. Very strange.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With