Skip to content

spawn model properties

Harmen Janssen edited this page Nov 20, 2015 · 8 revisions

The properties below can be used on the model level in a Spawn configuration file. For instance, MyModel.json could look like this:

{
  "label": "My Model",
  "description": "This is the pwettiest model",
  "inputs": []
}

order

(My)Sql statement that represents the default ordering of this model in the cms.

label

Human-readable model name, which can contains spaces etc. If not configured, this will fall back to the model name.

description

Description of this model type to display to admins in the cms.

route

When configured, a Preview button will be automatically added to the CMS form.
It's recommended to use named route, so in the case of:

routes.blog_view.route = "/blog/post/:slug"

You would configure blog_view as the value for route. Note that Javascript will try to replace any :variable bit with a model value of the same name.

creatable

Whether records of this data type can be created by admins in the cms.

deletable

Whether records of this data type are deletable by admins in the cms.

quickAddable

Whether this model is addable via a popin-window in the cms, containing a minimal set of required fields.

visible

Whether this model is visible by default in the cms main model menu.

module

By default, this is default. If set to garp, it will inherit the Garp model configuration of the same name.

behaviors

Model behaviors. See the separate chapter on Spawn behaviors.

relations

Model relations. See the separate chapter on Spawn relations.

inputs

The various fields, see separate chapter on Spawn input types.

listFields

A list of field names which will be used by default to show certain fields as columns in the cms list view.

unique

Use this to create a unique key consisting of multiple columns:

"unique": ["name", "foo", "bar"],

comment

A comment field intended for developers. Here, you can elaborate on model specifics.

Clone this wiki locally