Thursday, January 27, 2022

Should Query.add_ordering() raise FieldError exception?

The add_ordering() method has a call to the names_to_path() function with the following comment:

# names_to_path() validates the lookup. A descriptive
# FieldError will be raise if it's not.
self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)

(django.db.models.sql.query: ~1989 line)

Function names_to_path have optional fail_on_missing argument, but is don't pass  (== fail_on_missing=False) in call from add_ordering.

It's normal ?

It was added after the closed ticket https://code.djangoproject.com/ticket/31426

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6e56aa42-2e7b-4d07-b00b-666613b5d217n%40googlegroups.com.

No comments:

Post a Comment