On 17/01/2013 22:08, Russell Keith-Magee wrote:
On Mon, Dec 31, 2012 at 5:56 PM, Marco Paolini <markopaol...@gmail.com <mailto:markopaol...@gmail.com>> wrote: Hi all, sorry for the noise, forget my previous mail as it was pointing to the wrong commit, here's the good one: https://github.com/mpaolini/__django/commit/__b754abdeab204949510500ccb1b845__b7ad143542 <https://github.com/mpaolini/django/commit/b754abdeab204949510500ccb1b845b7ad143542> copying here the rest of the original mail: postgresql since version 9.2 added support for range types [1] they have a nice set of specialized operators like "overlaps", "left of", etc... [2] So I decided to work on a reference implementation for Django even if it looks like psycopg2 does not fully support yet these data types [3] The implementation is only a proof of concept and is not complete and not tested (but it does contain tests, of course!) I did: - datetime range python data type: two bounds plus inclusive/excusive info (very basic!) - datetime range model field - range specific lookups for querysets - non-overlapping constraint: db-level enforced with sql CONSTRAINT and model validation - some documentation TODO: - form, widget, modelform, localization, admin - more range types (int, bigint, etc...) - more validation against invalid ranges - better range type python implementation - more testing Do you like it? Any chances for it to land in master once it is completed? Or is it too specialized? Hi Marco, Great work! As for getting this into master -- we have to dance a fine line between supporting all the great features of a database like PostgreSQL, and guaranteeing cross-database compatibility. So - while I'm not sure there's a place for this in core (unless you can demonstrate how to implement range types on other backends), it should be *possible* to use this library as a third party extension. If there is any interface or refactoring that that can be done to the database backend API that would make this possible, I'm definitely open to making those changes. The other thing I'd suggest is to look at others doing similar work. For example, Zachary Voase has been working on extensions to Django's PostgreSQL backend to support a whole lot of extra PostgreSQL features[1]. From the look of it, he hasn't got to range types yet, so what you've done here could probably be added as part of that project. PostgreSQL has tons of great features, and it would be great to be able to expose them in a clean way to Django developers; better yet would be to expose them all as a single extension library.
Yep, looks like it can definitely land in django-postgres [1] leveraging Anssi work on custom lookup [2] will give it a go during the weekend and tell you if it worked [1] https://github.com/zacharyvoase/django-postgres [2] https://code.djangoproject.com/ticket/16187 Marco -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.