On Fri, Mar 6, 2009 at 5:51 AM, Jay Deiman <[email protected]> wrote:
>
> I'm currently trying to create a custom Field subclass for the Postgres
> specific "inet" and "cidr" types.  I have been able to create the
> classes and use them without issue so far.  The problem I am running
> into is that I would like to add some custom query filters for use with
> the filter() method.

This is one of those things that falls in the "possible, but not
particularly easy" category.

GeoDjango, for example, adds a whole lot of new filter types to handle
spatial fields:

http://geodjango.org/docs/db-api.html#spatial-lookup-types

GeoDjango does this is by subclassing the internal SQL Query class,
and overriding the way that the filter functions are evaluated. There
aren't any simple step-by-step instructions for doing this - you'll
need to pick apart the code a bit to see how all the parts fit
together.

However, I agree that this would be a useful feature to add (or
improve). This isn't something we want to be trivial to accomplish,
but it should be a lot easier for people who are adding fields that
have unusual operator requirements. I haven't dug into the details to
work out exactly how we would approach this - any proposals are
welcome, especially if you can work through the details to see what
might be possible.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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