Content Profiles¶
Content profiles let you change the way how your content should be edited and what validation rules should apply.
Definition¶
You can specify custom profiles in server/data/content_types.json file.
Then you can sync it with database using cli command:
python manage.py app:initialize_data --entity-name content_types
In the file there should be list of profiles:
[
{"_id": "story", "label": "Story", "enabled": 1, ...},
{"_id": "snap", "label": "Snap", "enabled": 0, ...}
]
Available fields are:
_idstringProfile id, its value will be set in
item.profilefield and will be available in output.labelstringLabel visible in the client.
descriptionstringOptional profile description.
priorityintUsed for sorting in descending order.
enabledbooleanFlag if profile is enabled (visible in lists) or not.
schemadictSchema configuration for profile. There you can define validation rules for Item Schema fields:
"schema": { "headline": { "type": "string", "required": true, "maxlength": 120, }, "keywords": { "type": "list", "required": true, "allowed": ["sport", "news"] } }
Keys are field names, and for each field you can specify:
typestringOne of
string,list,dict,integer,number.requiredbooleanIf
true, field must be there and be non empty.minlength,maxlengthintMinimum and maximum length allowed for
stringtype.allowedlistList of allowed values for
stringorlisttype.schemadictValidation rules for
dicttype items.nullablebooleanIf True the value can be set to
null.regexstringRegex validation rule, eg.:
"regex": "[a-z]+"
editordictEditor configuration for profile, there you can set what fields will be visible and how these should be displayed:
"editor": { "headline": { "order": 1, "sdWidth": "full", "enabled": true }, "body_html": { "order": 5, "formatOptions": ["h2", "bold", "italic"], "enabled": true }, "ednote": { "enabled": false } }
Rules for fields are:
orderintWhere the field is visible in the editor.
sdWidthstringOne of
full,halfandquarter. Fields are floating so there can be more on the same line as long as they fit there.enabledbooleanIf
falsefield won’t be visible in the editor.formatOptionslistWhat format options should be available, only works with
body_htmlandabstractfields. For each there will be a button visible in the editor toolbar.h2bolditalicunderlinequoteanchorembedpictureremoveFormat
Available schema fields¶
These are fields you can use in your content profile:
- class DefaultSchema[source]¶
Default schema.
- abstract = string¶
item abstract
- anpa_category = list¶
category
- anpa_take_key = string¶
anpa take key
- attachments = list¶
item attachments .. versionadded:: 1.29
- authors = list¶
authors
body footer
- body_html = string¶
item content
- byline = string¶
byline
- company_codes = list¶
company codes
- dateline = dict¶
dateline - info about where news was written
- ednote = string¶
editorial note
- feature_media = media¶
embedded media in the item
item footer
- genre = list¶
item genre
- headline = string¶
headline
- keywords = list¶
keywords
- language = string¶
language
- media_description = string¶
embedded media description
- place = list¶
place where news happened
- priority = integer¶
news item priority
- sign_off = string¶
item sign off info
- slugline = string¶
slugline
- sms = string¶
sms version of an item
- subject = list¶
subject
- urgency = integer¶
news item urgency
- usageterms = string¶
usageterms
Plain text profile¶
Before there are any content profiles defined for a desk there is one called Plain text.
Package profiles¶
Package profiles are not yet supported.