Transforms Model instances into seq[FormField] at runtime, which can be rendered into HTML forms in nimja templates.
Procs
proc extractFields[T: Model](model: T): seq[FormField]
- Converts the fields on a model into a sequence of FormField. Source Edit
proc toForeignKeyField[T: Model](value: int64; fieldName: static string; foreignKeyModelType: typedesc[T]): FormField
- Helper proc to convert a non-optional foreign key field on a Model into a select FormField with int value. Source Edit
proc toForeignKeyField[T: Model](value: Option[int64]; fieldName: static string; foreignKeyModelType: typedesc[T]): FormField
- Helper proc to convert a foreign key field on a Model into a select FormField with int value. Source Edit
func toFormField(value: Option[bool]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a bool field on Model into FormField metadata Source Edit
func toFormField(value: Option[DateTime]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a DateTime field on Model into FormField metadata Source Edit
func toFormField(value: Option[FilePath]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a FilePath field on Model into FormField metadata Source Edit
func toFormField(value: Option[float32]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a float32 field on Model into FormField metadata Source Edit
func toFormField(value: Option[float64]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a float64 field on Model into FormField metadata Source Edit
func toFormField(value: Option[int32]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a int32 field on Model into FormField metadata Source Edit
func toFormField(value: Option[int64]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a int64 field on Model into FormField metadata Source Edit
func toFormField(value: Option[int]; fieldName: string): FormField {....raises: [], tags: [], forbids: [].}
- Converts a int field on Model into FormField metadata Source Edit
func toFormField(value: Option[Natural]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a int field on Model into FormField metadata Source Edit
func toFormField(value: Option[string]; fieldName: string): FormField {. ...raises: [], tags: [], forbids: [].}
- Converts a string field on Model into FormField metadata Source Edit
func toFormField[T: enum or range](value: Option[T]; fieldName: string): FormField
-
Converts an enum or range field on Model into a select FormField with int values.
Note: This can not be split into 2 separate procs, as the compiler will immediately complain about ambiguity issues for the TaintedString type.
Source Edit func toFormField[T](value: T; fieldName: string): FormField
- Helper proc to enable converting non-optional fields into FormField metadata Source Edit