get current url with parameters url django

To get the current URL with parameters in Django, you can follow these steps:

  1. Import the resolve and build_absolute_uri functions from the django.urls module:
from django.urls import resolve
from django.http import request
  1. Use the resolve function to get the resolved view function and its arguments from the current request:
view_func, args, kwargs = resolve(request.path_info)
  1. Use the build_absolute_uri method of the request object to build the absolute URL with the parameters:
absolute_url = request.build_absolute_uri()
  1. Print or use the absolute_url as per your requirement.

Note: The resolve function resolves the URL path to the appropriate view function and returns a tuple containing the view function, positional arguments, and keyword arguments. The build_absolute_uri method builds an absolute URL using the current request's protocol, domain, and path.

I hope this helps! Let me know if you have any further questions.