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.

What I'm trying to do is make usable 4 filter options specific to these 
Fields.  Here are the names I'd like to use and their postgres operators:

'cidrct': '>> %s'
'cidrcte': '>>= %s'
'cidrctw': '<< %s'
'cidrctwe': '<<= %s'

I was originally hoping to somehow extend the "operators" dictionary 
listed in:

django.db.backends.postgresql_psycopg2.base.DatabaseWrapper

What exactly do I need to do to add those 4 filter opts so that if I had 
the following Model, I could use something to the effect of 
Netblock.objects.filter(inet__cidrct="1.2.3.4") and get back a Netblock 
entry of "1.2.3.0/24", for example:

class Netblock(BaseModel):
     inet = InetField()

Thanks,

Jay

-- 
Jay Deiman

\033:wq!

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to