diff --git a/categories/management/commands/import_categories.py b/categories/management/commands/import_categories.py
index fe63970..f0f164e 100644
--- a/categories/management/commands/import_categories.py
+++ b/categories/management/commands/import_categories.py
@@ -27,7 +27,7 @@ class Command(BaseCommand):
else:
return ' ' * indent_amt
- @transaction.commit_on_success
+ @transaction.atomic
def make_category(self, string, parent=None, order=1):
"""
Make and save a category object from a string
diff --git a/categories/templates/categories/ul_tree.html b/categories/templates/categories/ul_tree.html
index ef77d11..b6013de 100644
--- a/categories/templates/categories/ul_tree.html
+++ b/categories/templates/categories/ul_tree.html
@@ -1,5 +1,5 @@
{% load category_tags %}{% spaceless %}
-
- Top
+
- Top
{% for node,structure in path|tree_info %}
{% if structure.new_level %}
-
{% else %}
-
diff --git a/categories/tests/__init__.py b/categories/tests/__init__.py
index 194e08d..42800ce 100644
--- a/categories/tests/__init__.py
+++ b/categories/tests/__init__.py
@@ -1,6 +1,2 @@
-from categories.tests.category_import import *
-from categories.tests.templatetags import *
-from categories.tests.manager import *
-from categories.tests.registration import *
__fixtures__ = ['categories.json']
diff --git a/categories/tests/category_import.py b/categories/tests/test_category_import.py
similarity index 100%
rename from categories/tests/category_import.py
rename to categories/tests/test_category_import.py
diff --git a/categories/tests/manager.py b/categories/tests/test_manager.py
similarity index 100%
rename from categories/tests/manager.py
rename to categories/tests/test_manager.py
diff --git a/categories/tests/registration.py b/categories/tests/test_registration.py
similarity index 100%
rename from categories/tests/registration.py
rename to categories/tests/test_registration.py
diff --git a/categories/tests/templatetags.py b/categories/tests/test_templatetags.py
similarity index 97%
rename from categories/tests/templatetags.py
rename to categories/tests/test_templatetags.py
index 7487ed3..1ec8a80 100644
--- a/categories/tests/templatetags.py
+++ b/categories/tests/test_templatetags.py
@@ -1,5 +1,6 @@
from django.test import TestCase
from django import template
+import re
from categories.models import Category
@@ -29,12 +30,14 @@ class CategoryTagsTest(TestCase):
# display_path_as_ul
rock_resp = u''
resp = self.render_template('{% load category_tags %}{% display_path_as_ul "/Rock" %}')
+ resp = re.sub(r'\n$', "", resp)
self.assertEqual(resp, rock_resp)
# display_drilldown_as_ul
expected_resp = u''
resp = self.render_template('{% load category_tags %}'
'{% display_drilldown_as_ul "/World/Worldbeat" "categories.category" %}')
+ resp = re.sub(r'\n$', "", resp)
self.assertEqual(resp, expected_resp)
# breadcrumbs
diff --git a/example/manage.py b/example/manage.py
index 5e78ea9..2605e37 100755
--- a/example/manage.py
+++ b/example/manage.py
@@ -1,11 +1,10 @@
#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
+import os
+import sys
if __name__ == "__main__":
- execute_manager(settings)
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)
diff --git a/example/settings.py b/example/settings.py
index 5ac2c08..d5d3f51 100644
--- a/example/settings.py
+++ b/example/settings.py
@@ -123,6 +123,8 @@ CATEGORIES_SETTINGS = {
},
}
+TEST_RUNNER = 'django.test.runner.DiscoverRunner'
+
if django.VERSION[1] >= 4:
from settings14 import *
if django.VERSION[1] == 3:
diff --git a/example/simpletext/admin.py b/example/simpletext/admin.py
index 7d5ea8f..55a5d73 100644
--- a/example/simpletext/admin.py
+++ b/example/simpletext/admin.py
@@ -14,6 +14,7 @@ class SimpleTextAdmin(admin.ModelAdmin):
class SimpleCategoryAdminForm(CategoryBaseAdminForm):
class Meta:
model = SimpleCategory
+ fields = '__all__'
class SimpleCategoryAdmin(CategoryBaseAdmin):
form = SimpleCategoryAdminForm