<model> define a database model

name
model
xml namespace
http://moyaproject.com/db

Defines a database model, which maps data stored in a database table on to Moya objects.

Models are referenced by their libname in database expressions, the name attribute is used when creating tables. If you convert a model instance to a string, it will return the value of the repr attribute, with substitutions made with the object context.

Example

<model name="Permission" libname="Permission" xmlns="http://moyaproject.com/db"
    repr="Permission '${name}${description}">
    <string name="name" required="yes" null="no" blank="no" length="30" unique="yes"/>
    <text name="description" null="no" default=""/>
</model>
attributes
name purpose type required? default choices
abstract Is the model abstract? boolean No no
db Database to use (default will use the default database) text No
extends Extend this model element reference No
name Name of the model (used internally by the db) text No
repr Text representation of a model instance (substitution will use the model as a data context) raw No
template Optional template to render object text No
title Descriptive title text No