Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 552c1b5

Browse files
committedOct 7, 2011
Get operators for postgres no matter what db we are running
1 parent c9685bf commit 552c1b5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎netfields/managers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from IPy import IP
22

33
from django.db import models, connection
4+
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
45
from django.db.models import sql, query
56
from django.db.models.query_utils import QueryWrapper
67

7-
NET_OPERATORS = connection.operators.copy()
8+
NET_OPERATORS = DatabaseWrapper.operators.copy()
89

910
for operator in ['contains', 'startswith', 'endswith']:
1011
NET_OPERATORS[operator] = 'ILIKE %s'

‎tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DATABASES = {
22
'default': {
33
'ENGINE': 'django.db.backends.sqlite3',
4-
'NAME': 'netfields'
4+
'NAME': 'netfields',
55
}
66
}
77

0 commit comments

Comments
 (0)