Check if the given field should be treated as nullable. Some backends treat '' as null and Django treats such fields as nullable for those backends. In such situations field.null can be False even if we should treat the field as nullable.
(self, field)
| 2773 | return trimmed_prefix, contains_louter |
| 2774 | |
| 2775 | def is_nullable(self, field): |
| 2776 | """ |
| 2777 | Check if the given field should be treated as nullable. |
| 2778 | |
| 2779 | Some backends treat '' as null and Django treats such fields as |
| 2780 | nullable for those backends. In such situations field.null can be |
| 2781 | False even if we should treat the field as nullable. |
| 2782 | """ |
| 2783 | # We need to use DEFAULT_DB_ALIAS here, as QuerySet does not have |
| 2784 | # (nor should it have) knowledge of which connection is going to be |
| 2785 | # used. The proper fix would be to defer all decisions where |
| 2786 | # is_nullable() is needed to the compiler stage, but that is not easy |
| 2787 | # to do currently. |
| 2788 | return field.null or ( |
| 2789 | field.empty_strings_allowed |
| 2790 | and connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls |
| 2791 | ) |
| 2792 | |
| 2793 | |
| 2794 | def get_order_dir(field, default="ASC"): |
no outgoing calls
no test coverage detected