0

Here's the gist of my desired scenario:

I've got the standard Django pagination going in the admin site. What I'd like to do is let a user enter a number into a text input that corresponds to some page number. The user presses enter or clicks a button. Results for the page number entered are then shown.

Note:

  • I'm using Django 1.2.3 with Python 2.65
  • I'm modifying a ModelForm someone else created for our admin site.

Any ideas, suggestions, and/or comments greatly appreciated!

Thank you,

Michaux

mkelley33
  • 5,323
  • 10
  • 47
  • 71

1 Answers1

2

Every pagination system I have come across including the standard Django pagination uses GET parameters for rendering a page.

So, providing a form to get the page number of the page to be displayed is the simplest thing you can do with html forms.

<form>

    <input type="text" name="page">
    <input type="submit">

</form>

To include this, you might want to override the corresponding admin template.

lprsd
  • 84,407
  • 47
  • 135
  • 168
  • Thank you for the suggestion. I'm familiar with the markup needed and standard pagination schemes. However, I'm specifically asking about how something like this might be achieved without resorting to overriding the admin template. Is there another way to auto-generate the markup you provided? Might I be able to set some attribute(s) on the ModelAdmin form to accomplish this? – mkelley33 Dec 02 '10 at 08:28
  • No. To edit templates, you _need_ to override the templates. There is no simpler way. – lprsd Dec 02 '10 at 09:54
  • Much obliged. I was looking for a simpler, quick, and dirty fix, but in the absence of such a solution, I shall proceed to implement it as you've suggested! Thanks again :) – mkelley33 Dec 02 '10 at 14:46