Use *notnul=True* in Field constructor. http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor
On Saturday, April 2, 2022 at 11:59:19 AM UTC+5:30 rjwh...@gmail.com wrote: > (The following appends 2 previous posts that are still under review:) > > So here's additional info on the empty-field issue I'm having after > updating my web2py apps to version 2.22.3. The problem first noticed was > that records containing empty fields,* in NEW or UPDATED records only*, > display "None" in the empty fields, when displayed in my views or in > appadmin.html. Previously empty fields appeared blank, as is preferred. > Existing records still display empty fields as blank. > > After examining the data in an SQLite DB browser, I now see that new or > edited records have inserted "NULL" in the empty fields, while old records > still have blanks. I think I read somewhere that this may be related to > Python behavior; my apps are still running on Python 2.7.12. > > Another strange behavior I've discovered is that a field containing > "NULL" (and displaying as "None") does not evaluate properly in an > expression such as: > > sppa = db(db.specimen.type_status<>('Test')).select(orderby=db.specimen.id > ) > return dict(sppa=sppa) > > In the above example, since a type_status field containing "NULL" is not > equal to "Test", the row should appear in the displayed table---but it does > not appear. > > Unfortunately, I am stuck and cannot add or edit any records in my apps > until I get this sorted. Any help would be greatly appreciated. > > For context, see the default app at > https://specimens.mantodearesearch.com/ > > Thanks, > Rick > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e62aca8e-1568-4cbc-a939-999a1b854629n%40googlegroups.com.