from django import template

register = template.Library()

@register.simple_tag
def add_get_params(request_get, *args):
    """
    Constructs a GET query string by preserving all current
    parameters EXCEPT 'page', which is handled separately.
    """
    params = request_get.copy()
    
    # Remove the page parameter to prevent it from duplicating or interfering
    if 'page' in params:
        del params['page']
        
    # Return the URL-encoded string (e.g., department=IT&employment_type=FULL_TIME)
    # The template prepends the '&' and the 'page=X'
    return params.urlencode()