Default Object Classes for Uploads

Default Object Classes for Uploads

Setting object classes for content types

When uploading content to the CMS by means of the Content Browser, an object class that fits the content type needs to be determined. For this and for application-specific purposes, you can register the object classes to be used for specific content types:


Provide a mapping that consists of key-value pairs where each pair is made up of a content type pattern as the key and an object class name as the value. The content type patterns may include wildcards either in the file type part or both content type parts. When looking up an object class, the most specific match will be used. The more wildcards the key of a pair contains, the less specific it is. You can register one or more defaults at once and also override the existing defaults.

The Scrivito SDK initially provides two mappings:

  • image/* -> 'Image'
  • */* -> 'Download'

The corresponding models, Image and Download, are added to an application by the install generator.

Looking up an object class

To look up a default, you can use scrivito.default_obj_class_for_content_type(content_type), passing the content type in question as a string. Examples: