1
0
mirror of https://github.com/django/django.git synced 2025-06-01 17:49:12 +00:00

Replaced a hardcoded LOOKUP_SEP in models/fields/__init__.py

This commit is contained in:
Michal Petrucha 2016-06-09 11:56:12 -04:00 committed by Tim Graham
parent 37b36af6c6
commit effb4ed6f5

View File

@ -20,6 +20,7 @@ from django.core import checks, exceptions, validators
# purposes. # purposes.
from django.core.exceptions import FieldDoesNotExist # NOQA from django.core.exceptions import FieldDoesNotExist # NOQA
from django.db import connection, connections, router from django.db import connection, connections, router
from django.db.models.constants import LOOKUP_SEP
from django.db.models.query_utils import DeferredAttribute, RegisterLookupMixin from django.db.models.query_utils import DeferredAttribute, RegisterLookupMixin
from django.utils import six, timezone from django.utils import six, timezone
from django.utils.datastructures import DictWrapper from django.utils.datastructures import DictWrapper
@ -221,10 +222,10 @@ class Field(RegisterLookupMixin):
id='fields.E001', id='fields.E001',
) )
] ]
elif '__' in self.name: elif LOOKUP_SEP in self.name:
return [ return [
checks.Error( checks.Error(
'Field names must not contain "__".', 'Field names must not contain "%s".' % (LOOKUP_SEP,),
obj=self, obj=self,
id='fields.E002', id='fields.E002',
) )