#36167: Default value in migrations allows None/NULL
-------------------------------+--------------------------------------
     Reporter:  ivasilyev1     |                    Owner:  ivasilyev1
         Type:  Uncategorized  |                   Status:  closed
    Component:  Uncategorized  |                  Version:  5.1
     Severity:  Normal         |               Resolution:  wontfix
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  1              |  Patch needs improvement:  0
Easy pickings:  1              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Simon Charette):

 * resolution:   => wontfix
 * status:  assigned => closed

Comment:

 > But the combination of default=None doesn't really make sense to be
 allowed in the first place if the goal is to prevent NULL values.

 I understand where you are coming from but I'm not sure we should venture
 down the path of allowing or disallowing developer provided values.

 We allow string to be specified for `IntegerField`, strings longer than
 the specified `max_length` of a `CharField`, negative integer for
 `PositiveIntegerField`, and other values that are enforced at the database
 level through a constraint just like `NOT NULL` is.

 In other words, I don't think we should special case `None` for
 `null=False` fields here. We should either perform model field validation
 on the provided input as
 [https://docs.djangoproject.com/en/5.1/internals/contributing/bugs-and-
 features/#requesting-features a new feature request discussed on the
 forum] or keep things as they are. Given we decided not to check
 `Field.default` at all when defined by the developer (see
 ticket:25417#comment:26) I don't think we should get in the way of
 developers providing potentially bogus values through `makemigrations`
 either.

 Closing as ''wont-fix'' pending further discussions.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36167#comment:3>
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/01070194cef2ff6a-6dc49314-328d-4098-878a-e5e42a015861-000000%40eu-central-1.amazonses.com.

Reply via email to