gabor wrote: > > assuming that you want to differentiate between: > > - the user did not fill in the data > - the user's input was "" > > wouldn't it be better to represent this in html as a checkbox+an input > field? > > and by default have the checkbox unselected, and the input-field disabled. > and then if the user checks the checkbox, enable the field. > > and then in the view code, simply check the checkbox's value and set the > field to null or to what-was-in-the-input-field.
gabor, That's certainly more explicit but makes for a busier UI and also makes it more difficult to reuse a standard FormWrapper in the template. After thinking about this more, I can't come up with a case where the input value should ever be an empty string so I think always mapping an empty string to NULL on save() will work just fine. Just for some background, the use case here is that for a financial instrument editor (stock, bond, swap, etc.) there are certain fields that come from a third party data vendor but occasionlly the user will wish to override. Other fields are only maintained internally so they can be directly edited. For the overridable fields, if the user enters a new value, it will become the effective value for that field, but if they clear the field, it reverts back to the default value. For my specific case, I don't think treating empty fields as NULL will create a problem (and if it does I can use the "" as an easy workaround). Thanks for the ideas, though. -Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---