Fixed #21512 -- Added more complete information about Pillow and PIL in model_fields and model_forms tests.
Use str.isupper() to test if a string is uppercased.
Fixed #21355 -- try importing _imaging from PIL namespace first.
Fixed #21169 -- Reworked RelatedManager remove() and clear() methods to account for default filtering.

The `remove()` and `clear()` methods of the related managers created by
`ForeignKey`, `GenericForeignKey`, and `ManyToManyField` suffered from a
number of issues, notably, they caused multiple consecutive database operations
run without transaction handling, and they didn't respect default filtering when
present (i.e. the default manager on the related model implements a custom
`get_queryset`) which could lead to unexpected data loss.

Besides the expected new behavior, fixing these issues induced some backward
incompatible changes:

- The implementation of `remove()` for `ForeignKey` related managers changed
  from a series of `Model.save()` to a single `QuerySet.update()`, which
  means `pre_save` and `post_save` signals aren't called anymore.

- The `remove()` and `clear()` methods for `GenericForeignKey` related
  managers now perform bulk delete so `Model.delete()` isn't called anymore.

- The `remove()` and `clear()` methods for `ManyToManyField` related
  managers perform subqueries when filtering is involved, which may or may not
  be an issue depending on your database and your data itself.

Refs. #3871, #21174.

Thanks Anssi Kääriäinen for his help.
Used simpler queries for m2m clearing when possible.
Refs #21169 -- Added a bulk option to RelatedManager remove() and clear() methods.