<commit_before>.. _reference_settings:

========
Settings
========

The ``CATEGORIES_SETTINGS`` dictionary is where you can override the default settings. You don't have to include all the settings; only the ones which you want to override.

The default settings are:

.. code-block:: python
	
	CATEGORIES_SETTINGS = {
	    'ALLOW_SLUG_CHANGE': False,
	    'CACHE_VIEW_LENGTH': 0,
	    'RELATION_MODELS': [],
	    'M2M_REGISTRY': {},
	    'FK_REGISTRY': {},
	    'THUMBNAIL_UPLOAD_PATH': 'uploads/categories/thumbnails',
	    'THUMBNAIL_STORAGE': settings.DEFAULT_FILE_STORAGE,
	}
	
ALLOW_SLUG_CHANGE
=================

**Default:** ``False``

**Description:** Changing the slug for a category can have serious consequences if it is used as part of a URL. Setting this to ``True`` will allow users to change the slug of a category.

CACHE_VIEW_LENGTH
=================

**Default:** ``0``

**Description:** This setting will be deprecated soon, but in the mean time, it allows you to specify the amount of time each view result is cached.

RELATION_MODELS
===============

**Default:** ``[]``

**Description:** Relation models is a set of models that a user can associate with this category. You specify models using ``'app_name.modelname'`` syntax.

M2M_REGISTRY
============

**Default:** {}

**Description:** A dictionary where the keys are in ``'app_name.model_name'`` syntax, and the values are a string, dict, or tuple of dicts. See :ref:`registering_models`\ .

FK_REGISTRY
============

**Default:** {}
<commit_msg>Formally fixes #1 by adding the ability to specify a transliteration function.<commit_after>.. _reference_settings:

========
Settings
========

The ``CATEGORIES_SETTINGS`` dictionary is where you can override the default settings. You don't have to include all the settings; only the ones which you want to override.

The default settings are:

.. code-block:: python
	
	CATEGORIES_SETTINGS = {
	    'ALLOW_SLUG_CHANGE': False,
	    'CACHE_VIEW_LENGTH': 0,
	    'RELATION_MODELS': [],
	    'M2M_REGISTRY': {},
	    'FK_REGISTRY': {},
	    'THUMBNAIL_UPLOAD_PATH': 'uploads/categories/thumbnails',
	    'THUMBNAIL_STORAGE': settings.DEFAULT_FILE_STORAGE,
	    'SLUG_TRANSLITERATOR': lambda x: x,
	}
	
ALLOW_SLUG_CHANGE
=================

**Default:** ``False``

**Description:** Changing the slug for a category can have serious consequences if it is used as part of a URL. Setting this to ``True`` will allow users to change the slug of a category.

SLUG_TRANSLITERATOR
===================

**Default:** ``lambda x: x``

**Description:** Allows the specification of a function to convert non-ASCII characters in the potential slug to ASCII characters. Allows specifying a ``callable()`` or a string in the form of ``'path.to.module.function'``.

A great tool for this is `Unidecode <http://pypi.python.org/pypi/Unidecode>`_. Use it by setting ``SLUG_TRANSLITERATOR`` to ``'unidecode.unidecode``.

CACHE_VIEW_LENGTH
=================

**Default:** ``0``

**Description:** This setting will be deprecated soon, but in the mean time, it allows you to specify the amount of time each view result is cached.

RELATION_MODELS
===============

**Default:** ``[]``

**Description:** Relation models is a set of models that a user can associate with this category. You specify models using ``'app_name.modelname'`` syntax.

M2M_REGISTRY
============

**Default:** {}

**Description:** A dictionary where the keys are in ``'app_name.model_name'`` syntax, and the values are a string, dict, or tuple of dicts. See :ref:`registering_models`\ .

FK_REGISTRY
============

**Default:** {}

{'fraction_non_alphanumeric': 0.1611558766323979, 'fraction_numerical': 0.0025006946373992774, 'mean_word_length': 4.863192182410423, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2737364', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1065, 'n_words': 395}