Configuration

Optional features

Autogenerated domain hostname (disabled)

One optional information about assets is a domain hostname. This information can be autogenerated by Ralph Assets. To achieve that you need to set a few settings (in the Django’s standard way), like:

ASSETS_AUTO_ASSIGN_HOSTNAME = True

This action cause that all assets:

  • edited in Edit form or Bulk form,
  • having set Asset Owner & Asset Model & Asset model category code (according to: Asset.can_generate_hostname property),
  • and changed Asset status from any (except in progress) status to in progress,

will have autogenerated hostname domain.

Autogenerated format is described by this setting variable ASSET_HOSTNAME_TEMPLATE:

Default value is

ASSET_HOSTNAME_TEMPLATE = {
    'prefix': '{{ object.country_code|upper }}'
            '{{ object.model.category.code|upper }}',
    'postfix': '',
    'counter_length': 5,
}

where prefix and postfix options takes template string (rendered by Django’s template engine so you can use standard (or custom) template tags and filters). Template context contains object variable which is an asset instance. The counter_length variable describes constant length of counter.

There is also another related option:

HOSTNAME_FIELD_HELP_TIP = 'Autogenerated if owner & model are set.'

This setting shows help tip next to hostname field in form.

Transition configurations is described here