Giter Site home page Giter Site logo

boss_form's Introduction

boss_form

Simple implementation of django forms for ChicagoBoss.

This lib uses parameterized modules.

Main purpose of this lib is to simplify form creation and processing.

Form field definition

Fields are defined in form_fields/0 function as proplist in form {field_name, Options}.

Field Options

Required params:

  • type::atom() - field type, one of: [char_field, float_field, boolean_field, choice_field, file_field ] % please refer to Field types and Widgets doc
  • label::string() - field label as string

Optional params:

  • required::atom() - true/false Notifies if field is required to be present while checking form contents, defaults to false.
  • initial::term() - Initial value for field
  • widget::tuple() - Custom field widget in form {Module, Function}, note that widget should be saved outside of parametrized modules (i.e. not in form module)
  • html_options::proplist() - List of html properties [{Key::term(), Value::string()}], will be added to output as Key="Value"

Field specific params:

  • float_field can have format::string() param, this format will be used by io_lib to format field value. Default: "~.2f"
  • choice_field can have choices::proplist() param, in form [{value::term(), title::string()}]

Examples

Please see examples/ directory for sample app files.

Todos

  • add most used django field types
  • add most used django widgets
  • add inline documentation
  • add django-like output formats as_p, etc.
  • replace io_lib formatting with dtl
  • get rid of proxy functions inside form definition [data/0, errors/0, fields/0, as_table/0]

boss_form's People

Contributors

ngaranko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.