I’ve been doing a lot of work in Flask-Admin lately, and the thing that kept bugging me was editing a single field. I’d spot a typo in the list, click into the record’s edit form, change one field, save, and go back. That’s a lot of clicks for a one-character fix.
So I opened an issue proposing edits straight from the list view (#755) and then built it (#756, merged today).
It’s a new column_editable_list property on the ModelView:
Those columns become click-to-edit in the list. Click a cell, type, hit enter, and it saves over AJAX with X-editable. Works across the SQLAlchemy, MongoEngine, and Peewee backends, and posts a CSRF token with each edit.
The messy part was the data handling. My first attempt rendered a form field for every row and tried to process the whole page as a WTForms FieldList. That got out of hand fast. What worked was wrapping each field on its own and reusing the existing update_model method to save, so validation and the record-not-found case were already handled. That fix came out of the code review on the PR.
Update: this one stuck around, and I ended up maintaining it for a while afterward: an XSS fix to HTML-escape the editable values (#1002), nullable enums and blank selects (#1009), and eventually a rewrite that builds a form per input (#1160, #1162). A bunch of smaller ones in between too. column_editable_list is still in Flask-Admin.
The fix ended up being BIOS power profile settings. It was set to Performance Per Watt (DAPC) and needed to be set to “Performance”.
It’s very interesting that the BIOS power profile settings didn’t seem to affect Ubuntu 14.10’s disk read speed.
Troubleshooting:
I have three of the same server. All the servers are Dell r620’s with a PERC H710 Mini RAID controller (21.2.0-0007_A04 firmware) and have the exact same hard drives (Seagate ST300MM0006) in RAID 1 configurations. I’m seeing about 50% worse disk read performance on some versions of Ubuntu.
They only differences I can find in the hardware:
The BIOS version on the poorly performing machines is 1.4.8, the machine that’s performing well is on 1.6.0. The BIOS change log doesn’t appear to have any changes between the two versions that would affect anything.
The chipset version on the RAID controller of the poorly performing machines is rev 01 (ChipRevision: B0). The machine that’s performing well has the rev 05 chipset (ChipRevision: D1). The motherboard chipset revision is also different.
Here are the benchmark results for the different Ubuntu versions and RAID controller chipsets:
(mysql read speed test - using the same version of mysql across all 3 machines)
At one point, 2 of the rev 01 servers were using Ubuntu 14.04 and were getting similar bad benchmark results. After the upgrading them to 14.10, I immediately saw the disk read speed increase.
The performance on rev 01 machine with 13.04 was bad, but somehow the rev 05 machine with the same OS version was performing well. This told me it’s not a problem with the megaraid_sas driver, because the rev 01 and rev 05 machines with 13.04 had the same version.
It’s definitely a common mistake for people using WTForms. When you create a form and use something like datetime.date.today() as a default value, that value will always stay the same. The fix is to use “datetime.date.today” instead of datetime.date.today().