Django

Code

Ticket #4481 (new)

Opened 1 year ago

Last modified 6 months ago

Databrowse should use pagination

Reported by: anonymous Assigned to: nobody
Milestone: Component: django.contrib.databrowse
Version: SVN Keywords:
Cc: floguy@gmail.com, carlo.miron@gmail.com, travis.pinney@gmail.com Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Right now there is no pagination for the databrowse contrib app.

After attempting to use it on a legacy database with many records, my entire computer froze up from trying to access so much information from the database. Looking through the code, it seems very different from any other django code that I've seen, and I am not able to figure out a way (on my own) to implement object pagination.

Attachments

ticket4481.patch (5.2 kB) - added by floguy@gmail.com on 06/06/07 20:53:18.
first implementation of pagination on object instances
ticket4481-rev2.patch (6.1 kB) - added by floguy@gmail.com on 06/06/07 20:57:29.
The previous ticket was a mistake to upload: it was old. This is the correct ticket.
databrowse_pagination_calendars.diff (25.0 kB) - added by floguy@gmail.com on 07/12/07 02:17:18.
Heavily updated patch

Change History

06/05/07 17:46:59 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • summary changed from Databrowse chokes on large databases to Databrowse should use pagination.
  • needs_tests changed.
  • needs_docs changed.

I think you're right, databrowse probably should be using pagination. I'll leave as a design decision for the big cheeses though.

06/06/07 20:52:46 changed by floguy@gmail.com

  • cc set to floguy@gmail.com.
  • has_patch set to 1.

I have implemented this today. I have *no* clue if it's a good way of going about it, but it's been working flawlessly for me today.

The only problem is that I also modified one other thing with this patch: decouple presentation from logic. In trunk, the str method of django.contrib.databrowse.datastructures.EasyInstance? cuts off any characters after 30. In my patch, I bring that out of the data structures class and into the template with a templatetag.

I know that it's bad to put two items in one patch, but my svn diff is giving me this.

06/06/07 20:53:18 changed by floguy@gmail.com

  • attachment ticket4481.patch added.

first implementation of pagination on object instances

06/06/07 20:57:29 changed by floguy@gmail.com

  • attachment ticket4481-rev2.patch added.

The previous ticket was a mistake to upload: it was old. This is the correct ticket.

06/20/07 12:05:05 changed by Dorian

Hi floguy!

Thanks for the patch very much. Thats just what I was looking for!

But when I executed

patch -i ticket4481-rev2.patch -p0

the file

django/contrib/databrowse/templatetags/__init__.py

was not created, because it is empty. So I had to create it by hand to make the patch work properly.

Maybe there is a switch I should have used with the 'patch' command...

cheers Dorian

07/12/07 02:16:53 changed by floguy@gmail.com

I have made a LOT of updates to this code. My original patch was a 20-min deal, but this one has been me iterating over it on and off since my first attempt. It also fixes Calendars, so that at any point in the drill-down, you can break off and see the objects.

E.g. Start at years (2006, 2007), but you can select "See Objects ->" to get any object from 2006 or 2007.

Then drill down to 2006. You see all of the months that have objects. But for each one, you can select "See Objects ->" to get an object for that month. Then drill down to June. You see all the days... etc. and so on and so forth until you get to days. At that point you are forced to see the objects for that day.

I'm doing a terrible job of explaining this, but if you apply the patch and look at something which should be paginated, or view by calendar, it will immediately become clear.

I know that I tackled too much for one patch, but I did it because I needed the functionality, and I'm not good at fudging with diffs. Hopefully my work will help someone else as well.

07/12/07 02:17:18 changed by floguy@gmail.com

  • attachment databrowse_pagination_calendars.diff added.

Heavily updated patch

07/18/07 10:07:08 changed by anonymous

  • cc changed from floguy@gmail.com to floguy@gmail.com, carlo.miron@gmail.com.

10/24/07 21:32:40 changed by tlp

  • cc changed from floguy@gmail.com, carlo.miron@gmail.com to floguy@gmail.com, carlo.miron@gmail.com, travis.pinney@gmail.com.

05/28/08 06:56:38 changed by oxyum

Last patch isn't finished. It doesn't paginate child sets.


Add/Change #4481 (Databrowse should use pagination)




Change Properties
Action