﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16468	Django IPAddressField incorrectly casts values when querying	anonymous	nobody	"Django 1.3 running Postgres 9.0

I have a simple model with an IPAddressField. Before today my app only placed simple IP addresses into it (192.168.1.1 for example), but I expanded the functionality to accept ip ranges with CIDR notations (192.168.1.1/28 for example).

When I use django to get all records with an IP address which has a CIDR notation it issues the following SQL statement (abbreviated):
{{{
SELECT ..blah.. FROM ""x"" WHERE (HOST(""x"".""target"") = E'192.168.1.1/28' )
}}}
This is comparing a HOST to a string, and it returns 0 results even though there are several entries in the database. It returns the correct results when I alter the query and run it through my postgresql shell:
{{{
SELECT ..blah.. FROM ""x"" WHERE (HOST(""x"".""target"") = HOST('192.168.1.1/28') )
}}}
In short (at least on Postgresql) any data being compared against a IPAddressField should be cast to a HOST instead of a string."	Bug	closed	Database layer (models, ORM)	1.3	Normal	wontfix			Design decision needed	0	0	0	0	0	0
