Dossier Custom Tabs, Fields, and Filters

It is often necessary that a dossier feature additional tabs and fields.

To add custom tabs and fields to a dossier, do the following:

  1. Prepare the list of custom tabs and fields you want to add to a dossier.

  2. Open the findface-security configuration file.

    sudo vi /etc/ffsecurity/config.py
    
  3. Into the FFSECURITY section, insert the CUSTOM_FIELDS section with the following content:

    • 'items': the list of fields in a dossier. Describe each field with the following parameters:
      • 'name': field’s internal name, string.
      • 'label': field’s label in the web interface, string.
      • 'display': display format (form or list), string or array.
      • 'tab': tab that features the field. If not specified, the field appears on the main dossier page (that with a photograph).
      • 'editable': field’s editability, boolean.
      • 'type': field data type, string. Possible values:
        • list: requires items, additional parameter for lists (see below), expects objects {id, name} in dictionaries;
        • valuelist: expects elements of primitive types.
        • objectlist: allows for creating arrays of objects of required types.
        • datetime: primitive data type displayed as a datetime list.
        • date: primitive data type displayed as a date picker.
        • boolean: primitive data type displayed as a checkbox.
        • string: primitive data type string.
      • additional parameters for lists (type=list, type=valuelist):
        • multiple: possibility of selecting several items in the list, boolean.
        • items: dictionary used as a data source for the list.
        • allow_create: possibility of adding new items to the list.
        • custom_id: custom field for id (type=list).
      • additional parameters for object lists (type=objectlist).
        • object: objects used as a data source for the object list.
        • simple: indicator that the field expects data of a primitive type instead of objects, for example, expects strings with phone numbers.
    • 'filters': the list of search filters associated with the custom fields. Parameters:
      • 'name': filter’s internal name,
      • 'label': filter’s label in the web interface,
      • 'field': associated field in the format meta__[field name] (with double underscore).
    • 'tabs': the list of tabs in a dossier. The first listed tab corresponds to the main dossier page.
    FFSECURITY = {
    
    ...
    
        'CUSTOM_FIELDS': {
            'dossier_meta': {
                'items': [
                    {'name': 'recid','label':"",'display':['form','list']},
                    {'name': 'name','label':"",'display':'form'},
                    {'name': 'address','label':"",'display':'form'},
                    {'name': 'notation','label':"",'display':'form'},
                    {'name': 'nullcolumn','label':"",'display':'form'},
                    {'name': 'photo','label':"",'display':'form'},
                    {'name': 'age', 'label':"",'display':'form', 'tab': 'look'},
                    {'name': 'growth', 'label':"",'display':'form', 'tab': 'look'},
                ],
                'filters': [
                    {
                        'name': 'recid',
                        'label': 'meta Field',
                        'field': 'meta__recid',
                   },
                ],
                'tabs': [
                    {'name': 'main'},
                    {'name': 'look'},
                    {'name': 'crime'},
                ],
    
             }
         }
     }
    
  4. You will see the custom content appear in the web interface: