diff options
| author | François Freitag <francois.freitag@gmail.com> | 2016-09-17 06:29:14 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-17 09:29:14 -0400 |
| commit | 631ef6b2729f79c75f35cd32caa504dda7c32e9e (patch) | |
| tree | a965597f3c1260ef2e956fafcf46a9b0e8727f91 /django | |
| parent | 9027e6c8a3711034d345535036d1a276d9a8b829 (diff) | |
Made FieldError/FieldDoesNotExist messages uniform across Python versions.
Removed possible u'' prefixes on Python 2.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/options.py | 6 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py index 51022ab902..0cf1726315 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -223,7 +223,7 @@ class Options(object): if f.name == query or f.attname == query ) except StopIteration: - raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, query)) + raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, query)) self.ordering = ('_order',) if not any(isinstance(field, OrderWrt) for field in model._meta.local_fields): @@ -605,7 +605,7 @@ class Options(object): # unavailable, therefore we throw a FieldDoesNotExist exception. if not self.apps.models_ready: raise FieldDoesNotExist( - "%s has no field named %r. The app cache isn't ready yet, " + "%s has no field named '%s'. The app cache isn't ready yet, " "so if this is an auto-created related field, it won't " "be available yet." % (self.object_name, field_name) ) @@ -615,7 +615,7 @@ class Options(object): # field map. return self.fields_map[field_name] except KeyError: - raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, field_name)) + raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name)) def get_base_chain(self, model): """ diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 9c46ee4ca1..e6516194dd 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1339,7 +1339,7 @@ class Query(object): if pos == -1 or fail_on_missing: field_names = list(get_field_names_from_opts(opts)) available = sorted(field_names + list(self.annotation_select)) - raise FieldError("Cannot resolve keyword %r into field. " + raise FieldError("Cannot resolve keyword '%s' into field. " "Choices are: %s" % (name, ", ".join(available))) break # Check if we need any joins for concrete inheritance cases (the |
