Hi Ken,
Thank you for your fast reply.
We can assume without loss of generality that the function is like a function generating random number, and the parameter I want to select is the stop parameter, I have updated my initial post accordingly.
So my goal is that the randomnumber is not re-generated when we refresh the page, but only on clicking on the button.
You can find here after the traceback, in my real code the epr app is the abc in my first post.
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/epr
Django Version: 5.1.3
Python Version: 3.13.0
Installed Applications:
[‘authentication.apps.AuthenticationConfig’,
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘userprofile’,
‘quantumapplications’,
‘backends’,
‘epr’]
Installed Middleware:
[‘django.middleware.security.SecurityMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’,
‘django.middleware.common.CommonMiddleware’,
‘django.middleware.csrf.CsrfViewMiddleware’,
‘django.contrib.auth.middleware.AuthenticationMiddleware’,
‘django.contrib.messages.middleware.MessageMiddleware’,
‘django.middleware.clickjacking.XFrameOptionsMiddleware’]
Traceback (most recent call last):
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\core\handlers\exception.py”, line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\core\handlers\base.py”, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\contrib\auth\decorators.py”, line 60, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\Documents\Perso\Projects\myproject\myproject\epr\views.py”, line 41, in epr
return redirect(‘epr’, {‘backends’: backends, ‘result’:data_res})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\shortcuts.py”, line 49, in redirect
return redirect_class(resolve_url(to, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\shortcuts.py”, line 180, in resolve_url
return reverse(to, args=args, kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\urls\base.py”, line 88, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\julien\AppData\Local\anaconda3\envs\myproject\Lib\site-packages\django\urls\resolvers.py”, line 831, in _reverse_with_prefix
raise NoReverseMatch(msg)
^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: NoReverseMatch at /epr
Exception Value: Reverse for ‘epr’ with arguments ‘({‘backends’: <QuerySet [<GateBasedBackend: Simulator>, <GateBasedBackend: QPU>]>, ‘result’: {‘11’: 478, ‘00’: 522}},)’ not found. 1 pattern(s) tried: [‘epr\Z’]