Contrib

Model and form fields

class feincms.contrib.fields.JSONField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class django.db.models.fields.NOT_PROVIDED at 0x9b4777c>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=[], error_messages=None)

TextField which transparently serializes/unserializes JSON objects

See: http://www.djangosnippets.org/snippets/1478/

JSONField.get_prep_value(value)

Convert our JSON object to a string before we save

JSONField.to_python(value)

Convert our string value to JSON after we load it from the DB

JSONField.value_to_string(obj)

Extract our value from the passed object and return it in string form

Tagging

feincms.contrib.tagging.pre_save_handler(sender, instance, **kwargs)

Intercept attempts to save and sort the tag field alphabetically, so we won’t have different permutations in the filter list.

feincms.contrib.tagging.tag_model(cls, admin_cls=None, field_name='tags', sort_tags=False, select_field=False)

tag_model accepts a number of named parameters:

admin_cls If set to a subclass of ModelAdmin, will insert the tag
field into the list_display and list_filter fields.
field_name Defaults to “tags”, can be used to name your tag field
differently.
sort_tags Boolean, defaults to False. If set to True, a pre_save
handler will be inserted to sort the tag field alphabetically. This is useful in case you want a canonical representation for a tag collection, as when you’re presenting a list of tag combinations (e.g. in an admin filter list).
select_field If True, show a multi select instead of the standard
CharField for tag entry.

Table Of Contents

Previous topic

Context processors

Next topic

Settings

This Page