Repository navigation
adminsite 0.2.0
pip install adminsite==0.2.0
Forms have a new look: a field is white in the light theme and nearly black in the dark one, with a border that shows, and cards stand on a darker ground with their titles in a band. Three fixes matter to anyone on 0.1.0: saving a record could erase, in every inline row, a field that holds several values; leaving a text empty could make the database refuse the whole save; and a filtered list on a big table stopped counting at 10,000.
The docs are rewritten to be shorter and easier to follow. Getting started builds an admin in one file that runs as written, each page starts with the common case, and the examples link to the models they use. The docs are built with Zensical and published with each release, so they match the version on PyPI.
Before upgrading:
- On a view with
count_mode = CountMode.ESTIMATED, a search, a filter orscope_queryis now counted exactly, which on a very large table takes a full count (#82). - A project that overrides
form.html,detail.html,index.html,activity.html,import.html,error.html,_inlines.html,_page_numbers.html,_records_total.htmlorwidgets/checkbox.htmlshould start its copy again from the new one. - A project that builds its own stylesheet should build it again from the new
frontend/input.css, which draws the new fields. The ground behind the cards is now daisyUI'sbase-200, and--subtlecolours the band that holds a card's title.
What changed:
- A record whose text column cannot be null but has a default, such as
note: Mapped[str] = mapped_column(default=""), can be saved with that text empty. The edit form, inline rows, values changed in the list, the API and the import read the empty text as None, and the database refused the whole save. It is now stored as"", as is the key of a file removed from such a column. Any other field whose column cannot be null, such as a number or a choice, left empty on a record that exists is refused under its input, since a default only fills in a new record, unless the field is givenrequired=False. The edit form marks such a field required, so a choice there no longer offers Not set (#84). - On a view with
count_mode = CountMode.ESTIMATED, a search, a filter orscope_queryis counted exactly. The count stopped at 10,000, so the list, the filters drawer and the Actions menu said "more than 10,000" and the pager had no page numbers. The rows still come first and the total follows (#82). - In an inline row, an
EnumFieldwithmultiple=Trueand a link to many records work as they do on a view's own form. The row's values did not show, so saving the parent, even only to rename it, erased that field in every row, and a save kept only the first value picked. A link to many records made the parent's edit page fail with a server error as soon as a row held linked records. A link in a row searched among over a hundred records also keeps what was picked when the form comes back with an error (#87). - A new look for forms. A field is white in the light theme and nearly black in the dark one, with a border that shows, and its border and a ring take the accent while you type, where it drew a thick black frame. Cards stand on a darker ground with their titles in a band, a select has a thin arrow, date and time fields use the admin's own icons, a file field is a place to drop a file, and a disabled field looks disabled.
- A switch on a form says No while it is off. It said Yes either way.