diff --git a/HISTORY.rst b/HISTORY.rst index d778bbcda5..9a5ce21641 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -127,6 +127,7 @@ Fix passing the dynamic Meta class to the test model. - Support for proxy model permission inheritance. Proxy models now get the permission inheritance from their base models. +- Update common.http.URL to allow passing a query dictionary. 3.2.9 (2019-11-03) ================== diff --git a/mayan/apps/common/http.py b/mayan/apps/common/http.py index ba507523d2..02c274fdc6 100644 --- a/mayan/apps/common/http.py +++ b/mayan/apps/common/http.py @@ -6,15 +6,20 @@ from django.utils.six import PY3 class URL(object): - def __init__(self, path=None, query_string=None): + def __init__(self, path=None, query_string=None, query=None): self._path = path self._query_string = query_string + self._query = query + kwargs = {'mutable': True} - if query_string: - kwargs['query_string'] = query_string.encode('utf-8') + if self._query_string: + kwargs['query_string'] = self._query_string.encode('utf-8') self._args = QueryDict(**kwargs) + if self._query: + self.args.update(self._query) + @property def args(self): return self._args