Dynamically populate constraints in Field.contribute_to_class

Here’s what I found when digging in a while back:

I think a neat example is bounds checking for the battleship board game where each new game the players choose from predefined geometries like 10x5, 16x8, or 20x10. (Or maybe or tic tac toe, connect four, pen the pig, chess puzzles, etc. Square len(rows) == len(columns) will be simpler to model and check than non-square len(rows) != len(columns). A fuller example below:

wellplated/wellplated/models.py at main · biobuddies/wellplated · GitHub

You may find people advocating that new and improved Fields begin and grow as third party installables, without burdening the Django Foundation with maintenance, and with the option to someday/maybe merge upstream.

I think many Django projects could benefit from more comprehensive SQL constraints. To scope creep a little: what about harmonized checks at every level? HTML attributes/JavaScript for the frontends like the admin interface, Python code like full clean on save, and SQL constraints as the backstop?