mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
[-] 1.6/1.7/1.8 compatiable changes (WIP)
This commit is contained in:
parent
74cc9f8346
commit
a6443ada85
6 changed files with 29 additions and 11 deletions
|
|
@ -3,8 +3,9 @@ python:
|
|||
- "2.6"
|
||||
- "2.7"
|
||||
env:
|
||||
- DJANGO_VERSION=1.3.1
|
||||
- DJANGO_VERSION=1.4
|
||||
- DJANGO_VERSION=1.6.11
|
||||
- DJANGO_VERSION=1.7.7
|
||||
- DJANGO_VERSION=1.8
|
||||
install:
|
||||
- pip install Django==$DJANGO_VERSION
|
||||
- pip install -e .
|
||||
|
|
|
|||
16
categories/fixtures/categories.json
Normal file
16
categories/fixtures/categories.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[
|
||||
{
|
||||
"fields": {
|
||||
"level": 0,
|
||||
"lft": 1,
|
||||
"name": "Category 1",
|
||||
"order": 1,
|
||||
"parent": null,
|
||||
"rght": 10,
|
||||
"slug": "category-1",
|
||||
"tree_id": 1
|
||||
},
|
||||
"model": "categories.category",
|
||||
"pk": 1
|
||||
}
|
||||
]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from django import template
|
||||
from django.db.models import get_model
|
||||
from django.template import (Node, TemplateSyntaxError, VariableDoesNotExist,
|
||||
FilterExpression)
|
||||
from django.template import (Node, TemplateSyntaxError, VariableDoesNotExist)
|
||||
from django.template.base import FilterExpression
|
||||
from categories.base import CategoryBase
|
||||
from categories.models import Category
|
||||
from mptt.utils import drilldown_tree_for_node
|
||||
|
|
@ -186,7 +186,7 @@ def display_drilldown_as_ul(category, using='categories.Category'):
|
|||
cat = get_category(category, using)
|
||||
if cat is None:
|
||||
return {'category': cat, 'path': []}
|
||||
else:
|
||||
else:
|
||||
return {'category': cat, 'path': drilldown_tree_for_node(cat)}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
__fixtures__ = ['categories.json']
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
# test spaces in hierarchy
|
||||
# test tabs in hierarchy
|
||||
# test mixed
|
||||
import unittest
|
||||
import os
|
||||
|
||||
from django.test import TestCase
|
||||
from categories.models import Category
|
||||
from categories.management.commands.import_categories import Command
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
|
||||
class CategoryImportTest(unittest.TestCase):
|
||||
class CategoryImportTest(TestCase):
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
# test active returns only active items
|
||||
import unittest
|
||||
from django.test import TestCase
|
||||
from categories.models import Category
|
||||
|
||||
|
||||
class CategoryManagerTest(unittest.TestCase):
|
||||
class CategoryManagerTest(TestCase):
|
||||
fixtures = ['categories.json']
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue