Am 26.11.2008 13:19 Uhr, huw_at1 schrieb:
> A small part of my framework queries a non-Django db due to it being a
> legacy db with primary keys already in use. My question is is there a
> recognised way of applying pagination to non-Django db objects such
> that I can paginate the sql select query on this database?
>    
I am not shure I had understand your question correct.

The Django paginator works with lists/tuples, so all you have to do is 
either let your "other DB" act like a list/tuple, or build a small 
wrapper that allows the [from:to] syntax and a count() or __len__() method.

If that don't work you can of course overload the Paginator itself. I 
have done this [1] for CouchDB which has not yet any compatible wrapper 
and uses a completely different approach as it is an document-oriented 
database. My code is more a hack but it works well.

I would recommend to use the first approach if possible.

This is only my opinion and is of course not in any way official.

//Thomas

[1] http://www.djangosnippets.org/snippets/1208/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to