I
I
Ivan Vasilenko2017-10-04 08:51:42
Django
Ivan Vasilenko, 2017-10-04 08:51:42

How to get url in admin panel?

I need to get the string that is written in the admin url. Example site-name/admin/core/person/?param=blablabla/. I need to get the value of param . The only thing that comes to mind is to get this url and separate this line through split. I'm trying to create a procedure in views from request that returns get_full_path () but it returns something like although I tested it not in the admin panel, it returned the full url. Please tell me how can I get the url in the admin panel?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Astrohas, 2017-10-04
@Astrohas

request has a GET property and is written request.GET["param"].
if you mean parsing a ready-made url, then you can parse it through urllib.parse.urlparse.

N
NotProblem, 2017-10-06
@alexbog80

getting parameters self.request.GET.get('param', ''), if there is no given parameter, it will return an empty string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question