Utilities

feincms.utils.copy_model_instance(obj, exclude=None)

Copy a model instance, excluding primary key and optionally a list of specified fields.

feincms.utils.path_to_cache_key(path, max_length=200, prefix='')

Convert a string (path) into something that can be fed to django’s cache mechanism as cache key. Ensure the string stays below the max key size, so if too long, hash it and use that instead.

feincms.utils.shorten_string(str, max_length=50, ellipsis=u' \u2026 ')

Shorten a string for display, truncate it intelligently when too long. Try to cut it in 2/3 + ellipsis + 1/3 of the original title. Also try to cut the first part off at a white space boundary instead of in mid-word.

HTML utilities

Template tag helpers

I really hate repeating myself. These are helpers that avoid typing the whole thing over and over when implementing additional template tags

They help implementing tags of the following forms:

{% tag as var_name %}
{% tag of template_var as var_name %}
{% tag of template_var as var_name arg1,arg2,kwarg3=4 %}

Table Of Contents

Previous topic

Translations

Next topic

Views and decorators

This Page