title: How can I pass a page param in Django url template tag?
body: <p>I'm creating a simple search application. I have a model with some data, and the index page is just a search bar that search results of that model. I'm creating the form using just HTML, not a proper Django Form.</p>
  <p>index.html:</p>
  <pre><code>&lt;form method=&quot;get&quot; action=&quot;{% url 'core:search' %}?page=1&amp;q={{ request.GET.q }}&quot;&gt;
     &lt;div class=&quot;form-floating mb-3&quot;&gt;
        &lt;input type=&quot;search&quot; class=&quot;form-control&quot; id=&quot;floatingInput&quot; name=&quot;q&quot; value=&quot;{{ request.GET.q }}&quot;&gt;
        &lt;label for=&quot;floatingInput&quot;&gt;Type your search&lt;/label&gt;
     &lt;/div&gt;
     &lt;button class=&quot;w-100 btn btn-lg btn-primary&quot; type=&quot;submit&quot;&gt;Search&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>The results are paginated, so I need that the url requested by the form is <code>http://127.0.0.1:8000/search/?page=1&amp;q=query</code>, <code>query</code> being the search term typed in the input. But what I wrote in the <code>action</code> parameter in the form doesn't work as I expected: even though it's writen <code>action=&quot;{% url 'core:search' %}?page=1&amp;q={{ request.GET.q }}</code>, the URL requested is just <code>http://127.0.0.1:8000/search/?q=query</code>. The <code>page</code> param simply doesn't show up.</p>
  <p>I wrote <code>page=1</code> because, as is the search result, the first one requested is always the first page.</p>
  <p>The view that process this request is the <code>search_view</code>. I'm putting it below just as more info, but I think the problem is my misunderstanding of <code>url</code> template tag in the <code>action</code> form parameter.</p>
  <p>search_view:</p>
  <pre><code>def search_view(request):
      posts = Post.objects.all()
      query = request.GET.get('q')
      page_num = request.GET.get('page')
  
      paginator = Paginator(posts.annotate(
          search=SearchVector('post_title', 'post_subtitle'),
      ).filter(search=query).order_by('post_title'), 15)
  
      num_results = paginator.count
      num_pages = paginator.num_pages
  
      try:
          posts = paginator.page(page_num)
      except PageNotAnInteger:
          posts = paginator.page(1)
      except EmptyPage:
          posts = paginator.page(paginator.num_pages)
  
      context = {
          'posts': posts,
          'num_results': num_results,
          'num_pages': num_pages,
          'page_range': paginator.page_range,
      }
  
      return render(request, 'core/search.html', context)
  
  </code></pre>
  <p>How can I make the URL requested be like <code>http://127.0.0.1:8000/search/?page=1&amp;q=query</code> ?</p>