Skip to main content

save_record

Function save_record 

Source
pub async fn save_record<T: CmsAdmin>(
    pool: &Pool,
    row: &mut T,
    form: &AdminForm,
) -> Result<(), Vec<FieldError>>
Expand description

Apply a posted form to row and store it, running the hooks in order: CmsAdmin::admin_apply (skipping CmsAdminOverrides::read_only_fields), CmsAdminOverrides::validate, the save, CmsAdminOverrides::save_extra, then CmsAdminOverrides::after_save. A row without a primary key is added, and only when CmsAdminOverrides::can_create allows it.

ยงErrors

The validation messages, or one "_form" error carrying a refused add or a database failure.