__version_info__ = {
    'major': 0,
    'minor': 6,
    'micro': 0,
    'releaselevel': 'beta',
    'serial': 5
}

def get_version():
    vers = ["%(major)i.%(minor)i" % __version_info__, ]

    if __version_info__['micro']:
        vers.append(".%(micro)i" % __version_info__)
    if __version_info__['releaselevel'] != 'final':
        vers.append('%(releaselevel)s%(serial)i' % __version_info__)
    return ''.join(vers)

__version__ = get_version()

registry = {}

try:
    import fields

    from django.db.models import FieldDoesNotExist

    class AlreadyRegistered(Exception):
        """
        An attempt was made to register a model more than once.
        """
        pass

    registry = {}

    def register_m2m(model, field_name='categories', extra_params={}):
        return _register(model, field_name, extra_params, fields.CategoryM2MField)
    
    def register_fk(model, field_name='category', extra_params={}):
        return _register(model, field_name, extra_params, fields.CategoryFKField)
    
    def _register(model, field_name, extra_params={}, field=fields.CategoryFKField):
        registry_name = "%s.%s" % (model.__name__, field_name)
        if registry_name in registry:
            return #raise AlreadyRegistered
        registry[registry_name] = model
        opts = model._meta
        try:
            opts.get_field(field_name)
        except FieldDoesNotExist:
            field(**extra_params).contribute_to_class(model, field_name)
except ImportError:
    pass

@@ -486,17 +486,21 @@
  fields%0A
+    
 %0A
-
     from
@@ -542,17 +542,21 @@
 otExist%0A
+    
 %0A
-
     clas
@@ -688,17 +688,21 @@
    pass%0A
+    
 %0A
-
     regi
@@ -711,17 +711,21 @@
 ry = %7B%7D%0A
+    
 %0A
-
     def 
@@ -1170,32 +1170,41 @@
 __, field_name)%0A
+        %0A
         if regis
@@ -1422,16 +1422,16 @@
 tExist:%0A
-
         
@@ -1495,16 +1495,2230 @@
 d_name)%0A
+    %0A    from categories import settings%0A    from django.core.exceptions import ImproperlyConfigured%0A    from django.db.models import get_model%0A    %0A    for key, value in settings.FK_REGISTRY.items():%0A        model = get_model(*key.split('.'))%0A        if model is None:%0A            raise ImproperlyConfigured('%25s is not a model' %25 key)%0A        if isinstance(value, (tuple, list)):%0A            for item in value:%0A                if isinstance(item, basestring):%0A                    register_fk(model, item)%0A                elif isinstance(item, dict):%0A                    field_name = item.pop('name')%0A                    register_fk(model, field_name, extra_params=item)%0A                else:%0A                    raise ImproperlyConfigured(%22CATEGORY_SETTINGS%5B'FK_REGISTRY'%5D doesn't recognize the value of %25s%22 %25 key)%0A        elif isinstance(value, basestring):%0A            register_fk(model, value)%0A        elif isinstance(item, dict):%0A            field_name = item.pop('name')%0A            register_fk(model, field_name, extra_params=item)%0A        else:%0A            raise ImproperlyConfigured(%22CATEGORY_SETTINGS%5B'FK_REGISTRY'%5D doesn't recognize the value of %25s%22 %25 key)%0A    for key, value in settings.M2M_REGISTRY.items():%0A        model = get_model(*key.split('.'))%0A        if model is None:%0A            raise ImproperlyConfigured('%25s is not a model' %25 key)%0A        if isinstance(value, (tuple, list)):%0A            for item in value:%0A                if isinstance(item, basestring):%0A                    register_m2m(model, item)%0A                elif isinstance(item, dict):%0A                    field_name = item.pop('name')%0A                    register_m2m(model, field_name, extra_params=item)%0A                else:%0A                    raise ImproperlyConfigured(%22CATEGORY_SETTINGS%5B'M2M_REGISTRY'%5D doesn't recognize the value of %25s: %25s%22 %25 (key, item))%0A        elif isinstance(value, basestring):%0A            register_m2m(model, value)%0A        elif isinstance(value, dict):%0A            field_name = value.pop('name')%0A            register_m2m(model, field_name, extra_params=value)%0A        else:%0A            raise ImproperlyConfigured(%22CATEGORY_SETTINGS%5B'M2M_REGISTRY'%5D doesn't recognize the value of %25s%22 %25 key)%0A    %0A
 except I

Enable registering of models in settings.