#35726: db.models.TextField.formfield() does not behave like 
CharField.formfield()
when null=True
-----------------------------+-----------------------------------------
     Reporter:  Ole Laursen  |                     Type:  Uncategorized
       Status:  new          |                Component:  Uncategorized
      Version:  5.0          |                 Severity:  Normal
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+-----------------------------------------
 I have a specific use case where I need null instead of the empty string
 in the database when some text fields passing through a form are not
 filled in.

 This works fine for CharFields, but I recently discovered that it doesn't
 for TextFields. For TextFields they always turn out as the empty string.

 It looks like CharField has this specific support for setting empty_value
 = None in .formfield(), but TextField does not:

 {{{
         if self.null and not
 connection.features.interprets_empty_strings_as_nulls:
             defaults["empty_value"] = None
 }}}

 I would expect them to behave the same.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35726>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191b23f4300-61cbe7f5-d3fc-4f8d-a198-3306f8da3b4d-000000%40eu-central-1.amazonses.com.

Reply via email to