Skip to main content

register_chooser

Macro register_chooser 

Source
macro_rules! register_chooser {
    ($ty:ty, $slug:expr, $label:expr, $title_field:expr, $sub_field:expr $(,)?) => { ... };
}
Expand description

Register a generic chooser for a #[derive(Model)] type.

ⓘ
rustango_cms::register_chooser!(crate::Author, "author", "Author", "name", "email");
// → /cms-admin/__chooser/author?q=… ; a widget with
//   data-chooser-kind="author" drives it via the shared overlay.

The model must derive serde::Serialize (rows are serialised to JSON for the search filter). Search uses the model’s admin(search_fields = …).