DavidA wrote: > > Malcolm Tredinnick wrote: >> When I first started using Django, this drove me nuts. > > I had the same reaction, but also understand there isn't a great way to > handle it. In Microsoft's SQL Enterprise Manager, you can enter Ctrl-0 > in a field and it will set that field to NULL. I'm thinking about doing > something like this in one of my Django forms since I need to support > both an empty string _and_ a NULL input so I want an explicit way to > differentiate between the two. A control character doesn't work well > for browser input, but I may end up treating an empty string as NULL > and force the user to put "" if they really want a blank string (which > in this case is the exception, not the norm).
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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---