kashifpk / PyCK

Python Code Karigar - A web framework aimed at being easy to use and powerful
http://pyck.compulife.com.pk
Other
4 stars 0 forks source link

CRUD Field translations #57

Closed kashifpk closed 9 years ago

kashifpk commented 9 years ago

Allow translating a field's display value by calling a user defined function. So for example if a user wants to display 'Yes' when a field's value is true, it can be done with something like:

def translate_is_active(input_value):
      return 'Yes' if input_value else 'No'

field_translations = {
    'is_active': translate_is_active
}
kashifpk commented 9 years ago

We also need support for translating the field header, so an option is needed to give a different field header name. Something like:

def translate_is_active(input_value):
    return 'Yes' if input_value else 'No'

field_translations = {
    'is_active': {
          'header': 'Account Active', 
          'translator': translate_is_active
    }
}