Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:08:39+00:00 2026-06-03T07:08:39+00:00

I’m trying to use Pagination in my simple search and display application written in

  • 0

I’m trying to use Pagination in my simple search and display application written in Django.

I’ve followed the tutorial on Pagination from Djangoproject but there is no data being sent to the server.

I’ve used pdb.set_trace() to view the output of the code, and the GET dictionary is empty.

Here is the code in the template and the URLs file:

results.html:

<form method="GET" id="searchForm" action="/search/">
        <input type="text" id="billSearched" name="q_word">
        <input type="submit" value="{% trans "Look for" %}">
</form>

urls.py:

urlpatterns = patterns('',
    url(r'^$','ps.views.bills',name="bills"),
    url(r'^i18n/', include('django.conf.urls.i18n')),
    url(r'^search/','ps.views.search',name="search"),)

and the view that works with this, search.py:

def search(request):
    import pdb
    pdb.set_trace()
    searchTerm = request.GET.get('q_word')
    if searchTerm == None:
        searchTerm = "test"
    found_bills = Bill.objects.filter(name__icontains = searchTerm)
    page = request.GET.get('page')
    paginator = Paginator(found_bills,25)
    try:
        current_page = paginator.page(page)
    except PageNotAnInteger:
        current_page = paginator.page(1)
    except (EmptyPage, InvalidPage):
        current_page = paginator.page(paginator.num_pages)
return render(request,'results.html',{"results":current_page,"term": searchTerm})

Why is there no data being sent? I have read other posts as well and the solutions there didn’t work for me. They suggested to access the ‘q_word’ value in the GET dictionary with either request.GET.get('q_word') or with request.GET['q_word'] and by their answers it should work, but for me it doesn’t.

Where is my mistake? Thank you very much in advance!

UPDATE:

[02/May/2012 14:03:59] "GET / HTTP/1.1" 200 39694
Traceback (most recent call last):
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 284, in run
    self.finish_response()
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 324, in finish_response
    self.write(data)
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 403, in write
    self.send_headers()
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 467, in send_headers
    self.send_preamble()
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 385, in send_preamble
    'Date: %s\r\n' % http_date()
  File "/usr/lib/python2.7/socket.py", line 324, in write
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59087)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/radu/projects/psdemo/.venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 570, in __init__
    BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:08:41+00:00Added an answer on June 3, 2026 at 7:08 am

    The problem is that query parameters are not being appended to the end of the URL when you submit. I suggest you use this syntax for the form:

    <form id="searchForm" method="GET" action="/search/">
    <fieldset>
    <input type="text" id="billSearched" name="q_word">
    <br />
    <input type="submit" value="{% trans "Look for" %}">
    </fieldset>
    </form>
    

    This should make your URL end with ?q_word=search_term when you submit the form.

    urls.py looks fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Seemingly simple, but I cannot find anything relevant on the web. What is the
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.