Opened 9 years ago

Closed 5 years ago

Last modified 3 years ago

#4481 closed Cleanup/optimization (wontfix)

Databrowse should use pagination

Reported by: anonymous Owned by: nobody
Component: contrib.databrowse Version: master
Severity: Normal Keywords:
Cc: floguy@…, carlo.miron@…, travis.pinney@…, dane.springmeyer@…, bas@…, dvanliere@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (3)

ticket4481.patch (5.2 KB) - added by floguy@… 9 years ago.
first implementation of pagination on object instances
ticket4481-rev2.patch (6.1 KB) - added by floguy@… 9 years ago.
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@… 9 years ago.
Heavily updated patch

Download all attachments as: .zip

Change History (18)

comment:1 Changed 9 years ago by Chris Beaven

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Summary: Databrowse chokes on large databasesDatabrowse should use pagination
Triage Stage: UnreviewedDesign decision needed

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

comment:2 Changed 9 years ago by floguy@…

Cc: floguy@… added
Has patch: set

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.

Changed 9 years ago by floguy@…

Attachment: ticket4481.patch added

first implementation of pagination on object instances

Changed 9 years ago by floguy@…

Attachment: ticket4481-rev2.patch added

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

comment:3 Changed 9 years ago 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

comment:4 Changed 9 years ago by floguy@…

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.

Changed 9 years ago by floguy@…

Heavily updated patch

comment:5 Changed 9 years ago by anonymous

Cc: carlo.miron@… added

comment:6 Changed 9 years ago by tlp

Cc: travis.pinney@… added

comment:7 Changed 8 years ago by Ivan Fedorov

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

comment:8 Changed 8 years ago by springmeyer

Cc: dane.springmeyer@… added

Any movement on this?

comment:9 Changed 7 years ago by Vasily Ivanov

Cc: bas@… added

is it going to be included in the official release?

comment:10 Changed 6 years ago by Alex Gaynor

Triage Stage: Design decision neededAccepted

comment:11 Changed 6 years ago by drdee

Cc: dvanliere@… added

Will this be part of Django 1.3?

comment:12 Changed 6 years ago by Gabriel Hurley

Severity: Normal
Type: Cleanup/optimization

comment:13 Changed 5 years ago by Julien Phalip

Easy pickings: unset
Needs tests: set

comment:14 Changed 5 years ago by Preston Holmes

Resolution: wontfix
Status: newclosed
UI/UX: unset

Databrowse is now deprecated, see #16907

comment:15 Changed 3 years ago by Alireza Savand

Note: See TracTickets for help on using tickets.
Back to Top