#36813: Convert system checks for max_length and max_digits to __init__() 
checks.
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  Mehraz
         Type:                       |  Hossain Rumman
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):

 I hear that. I was definitely suggesting to bifurcate where validation is
 done given what you point out about `connection`-aware validation.

 I guess I thought we'd already started down that path, e.g. the following
 classes all have static, non-connection-aware validation in their
 constructors:

 - `CompositePrimaryKey`
 - `GeneratedField`
 - `JSONField`
 - `FileField`
 - `ManyToManyField`

 I get bifurcation without a reason is to be avoided, but I think there's
 something compelling about validating types as close to the perimeter as
 possible instead of whackamoling checks throughout the ORM (or doing it
 too late, say, inside `db_type()` and then suffering from a lack of parity
 in third-party expressions that don't implement that checking). If there's
 an elegant solution to do it once in the ORM, I'd definitely take a look.

 Should we accept this for investigation and ask a contributor to look into
 multiple approaches?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36813#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019b4834f6cf-14235b03-7ceb-4a37-8776-a3f97f491242-000000%40eu-central-1.amazonses.com.

Reply via email to