Dashboards & Visualizations

Why splunkdj redirect removes GET parameters?

dorilevy
Path Finder

Hey,

I am working with splunkdj. I created a view, added it to urls.py and created view function in views.py that handles the get parameters (using request.GET parameters dict).
It is working when i specify the URL with the parameters directly, but when the request is passing thought the redirect (redirect.tmpl) the get parameters are not passed to the function. i added a raise exception in the views.py and i can see the querydict empty:

Traceback (most recent call last):
  File "/opt/splunk/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/opt/splunk/etc/apps/framework/server/splunkdj/decorators/render.py", line 74, in wrapper
    output = function(request, *args, **kwargs)
  File "/opt/splunk/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/opt/splunk/etc/apps/Ingest/django/Ingest/views.py", line 20, in fxreport
    raise Exception("Report was not provided %s %s" % (str(request.GET),request.get_full_path()))
    **Exception: Report was not provided  /dj/en-us/Ingest/fxreport <QueryDict: {}> /dj/en-us/Ingest/fxreport**

Does anyone have an idea on how to solve it?

Regards,
Dori

0 Karma
1 Solution

dorilevy
Path Finder

Hey,

I solved it by copying the redirect.tmpl and to a new file redirect_params.tmpl and added:
params = window.location.search
document.location = "${root}dj/${locale}/${APP['id']}/newview" + params

I had to hardcoded the view name (newview) in the file.

Regards,
Dori

View solution in original post

nehakakar
Loves-to-Learn Everything

You may Try this.

from django.shortcuts import redirect

def my_redirect_view(request):
    # Manually append GET parameters to the redirect URL
    redirect_url = '/my_destination/?param1=value1&param2=value2'
    return redirect(redirect_url)

 

0 Karma

dorilevy
Path Finder

Hey,

I solved it by copying the redirect.tmpl and to a new file redirect_params.tmpl and added:
params = window.location.search
document.location = "${root}dj/${locale}/${APP['id']}/newview" + params

I had to hardcoded the view name (newview) in the file.

Regards,
Dori

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...