Author: Corey Oordt


Django Categories


.. |BUILD| image::
.. _BUILD:!/callowayproject/django-categories

Django Categories grew out of our need to provide a basic hierarchical taxonomy management system that multiple applications could use independently or in concert.

As a news site, our stories, photos, and other content get divided into "sections" and we wanted all the apps to use the same set of sections. As our needs grew, the Django Categories grew in the functionality it gave to category handling within web pages.

New in 1.2

* Support for Django 1.5
* Dropped support for Django 1.2
* Dropped caching within the app
* Removed the old settings compatibility layer. *Must use new dictionary-based settings!*

New in 1.1

* Fixed a cosmetic bug in the Django 1.4 admin. Action checkboxes now only appear once.

* Template tags are refactored to allow easy use of any model derived from ``CategoryBase``.

* Improved test suite.

* Improved some of the documentation.

Upgrade path from 1.0.2 to 1.0.3

Due to some data corruption with 1.0.2 migrations, a partially new set of migrations has been written in 1.0.3; and this will cause issues for users on 1.0.2 version. There is also an issue with South version 0.7.4. South version 0.7.3 or 0.7.5 or greater works fine.

For a clean upgrade from 1.0.2 to 1.0.3 you have to delete previous version of 0010 migration (named and fakes the new 00010, 0011 and 0012.

Therefore after installing new version of django-categories, for each project to upgrade you should execute the following commans in order::

    python migrate categories 0010_add_field_categoryrelation_category --fake --delete-ghost-migrations
    python migrate categories 0011_move_category_fks --fake
    python migrate categories 0012_remove_story_field --fake
    python migrate categories 0013_null_category_id

This way both the exact database layout and migration history is restored between the two installation paths (new installation from 1.0.3 and upgrade from 1.0.2 to 1.0.3).

Last migration is needed to set the correct null value for `category_id` field when upgrading from 1.0.2 while is a noop for 1.0.3.

New in 1.0

**Abstract Base Class for generic hierarchical category models**
   When you want a multiple types of categories and don't want them all part of the same model, you can now easily create new models by subclassing ``CategoryBase``. You can also add additional metadata as necessary.

   Your model's can subclass ``CategoryBaseAdminForm`` and ``CategoryBaseAdmin`` to get the hierarchical management in the admin.

   See the docs for more information.

**Increased the default caching time on views**
   The default setting for ``CACHE_VIEW_LENGTH`` was ``0``, which means it would tell the browser to *never* cache the page. It is now ``600``, which is the default for `CACHE_MIDDLEWARE_SECONDS <>`_

**Updated for use with Django-MPTT 0.5**
   Just a few tweaks.

**Initial compatibility with Django 1.4**
   More is coming, but at least it works.

**Slug transliteration for non-ASCII characters**
   A new setting, ``SLUG_TRANSLITERATOR``, allows you to specify a function for converting the non-ASCII characters to ASCII characters before the slugification. Works great with `Unidecode <>`_.

Updated in 0.8.8

The `editor` app was placed inside the categories app, `categories.editor`, to avoid any name clashes.


A setting change is all that is needed::


New in 0.8

**Added an active field**
	As an alternative to deleting categories, you can make them inactive.

	Also added a manager method ``active()`