#36842: Blank FloatField validation is not run on django admin and value is 
lost on
edition.
-------------------------------------+-------------------------------------
     Reporter:  pawel-steto          |                     Type:
                                     |  Uncategorized
       Status:  new                  |                Component:
                                     |  contrib.admin
      Version:  6.0                  |                 Severity:  Normal
     Keywords:  admin validation     |             Triage Stage:
  floatfield blank                   |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 Hello,

 Having the following model and associated admin:

 {{{
 from django.db import models

 class FooBar(models.Model):
     float_req = models.FloatField()
     float_not_req = models.FloatField(null=True, blank=True)
 }}}

 {{{
 from django.contrib import admin

 from .models import FooBar

 admin.site.register(FooBar)
 }}}

 If you:
 1. Create an entry with both float fields set
 2. In django admin, edit the float_not_req field entering an invalid float
 (a string for example)
 3. Save the model

 No issue is shown, the value of the field is overridden and set to None

 But If you do the same for the required float field, a validation error is
 raised and the field is not overridden.

 I know it is possible to change this behavior overriding the save/clean
 logic in django admin but I think this is misleading.

 Have a nice day,
 Pawel
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36842>
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/0107019b8f0a2920-a37b702e-5c54-4eae-a927-e7516ecc567a-000000%40eu-central-1.amazonses.com.

Reply via email to