[Answered ]-Getting error while using HttpRequest.build_absolute_uri(location) in Django

2👍

I think that the error you are getting is very definitive. build_absolute_uri is an instance method so should be called by an HttpRequest instance.

>>> from django.http import HttpRequest

>>> request = HttpRequest()
>>> location = reverse("admin:appname_question_change", args=(new_question.pk,))
>>> url = request.build_absolute_uri(location)

Leave a comment