
&^c           @   s;   d  d l  m Z e j   Z e j d e  d    Z d S(   i(   t   templatet   takes_contextc         K   s   |  d j  j   } x$ | j   D] \ } } | | | <q  Wx: g  | j   D] \ } } | sJ | ^ qJ D] } | | =qf W| j   S(   s}  
    Return encoded URL parameters that are the same as the current
    request's parameters, only with the specified GET parameters added or changed.

    It also removes any empty parameters to keep things neat,
    so you can remove a parm by setting it to ``""``.

    For example, if you're on the page ``/things/?with_frosting=true&page=5``,
    then

    <a href="/things/?{% param_replace page=3 %}">Page 3</a>

    would expand to

    <a href="/things/?with_frosting=true&page=3">Page 3</a>

    Based on
    https://stackoverflow.com/questions/22734695/next-and-before-links-for-a-django-paginated-query/22735278#22735278
    t   request(   t   GETt   copyt   itemst	   urlencode(   t   contextt   kwargst   dt   kt   v(    (    s:   /var/www/agenderbackend/backoffice/templatetags/my_tags.pyt   param_replace   s    2N(   t   djangoR    t   Libraryt   registert
   simple_tagt   TrueR   (    (    (    s:   /var/www/agenderbackend/backoffice/templatetags/my_tags.pyt   <module>   s   