#29947: Inlines containing a field with default value are considered empty and not saved --------------------------------+-------------------------------------- Reporter: ksl | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 2.1 Severity: Normal | Resolution: Keywords: inline default | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------+--------------------------------------
Comment (by ksl): I see your point now. It then all boils down to the meaning of a field's default. I always thought of "default" as a way for my users to be provided with a sensible default (hey!) value so that they are not forced to pick that value in a select (for instance). On the other hand, what you are describing is a "default" that almost behaves as a "blank value". Since having `blank=False` along with a `default` value for a given field does not lead to the desired result (ie: the field being saved with its default value) and that changing that would be backwards-incompatible, may I propose an additional boolean flag (`save_default`?) on `Field`, as follows? {{{ age = models.PositiveSmallIntegerField(_("age"), blank=False, null=False, default=0, save_default=True) }}} If not doable, maybe some list borne by the `ModelAdmin`: `save_defaults = [age]`? -- Ticket URL: <https://code.djangoproject.com/ticket/29947#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/061.fb2c00dce0cd463e0e633c56281e390c%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.