Skip to content

Commit 07d1979

Browse files
committed
Merge pull request #26 from Tourmanage/django-1.7
Django 1.7 support
2 parents 594f9ab + af94133 commit 07d1979

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

.travis.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@ language: python
33
python:
44
- 2.6
55
- 2.7
6+
- 3.2
7+
- 3.3
68
- pypy
79

10+
env:
11+
- DJANGO=Django==1.6
12+
- DJANGO=git+https://github.com/django/django.git@stable/1.7.x
13+
14+
matrix:
15+
exclude:
16+
- python: 2.6
17+
env: DJANGO=git+https://github.com/django/django.git@stable/1.7.x
18+
allow_failures:
19+
- env: DJANGO=git+https://github.com/django/django.git@stable/1.7.x
20+
821
install:
9-
- pip install -e .
10-
- pip install --use-mirrors coveralls
11-
- pip install --use-mirrors nose
22+
- pip install -q -e .
23+
- pip install -q $DJANGO
24+
- pip install -q --use-mirrors coveralls
25+
- pip install -q --use-mirrors nose
1226

1327
script: coverage run --source=menu `which django-admin.py` test --settings=menu.test_settings menu
1428

menu/menu.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import re
2+
13
from django.conf import settings
24

3-
import re
5+
try:
6+
from django.apps import apps
7+
except ImportError:
8+
apps = False
49

510

611
class Menu(object):
@@ -47,15 +52,20 @@ def load_menus(c):
4752
if c.loaded:
4853
return
4954

55+
# Fetch all installed app names
56+
app_names = settings.INSTALLED_APPS
57+
if apps:
58+
app_names = [app_config.name for app_config in apps.get_app_configs()]
59+
5060
# loop through our INSTALLED_APPS
51-
for app in settings.INSTALLED_APPS:
61+
for app in app_names:
5262
# skip any django apps
5363
if app.startswith("django."):
5464
continue
5565

5666
menu_module = '%s.menus' % app
5767
try:
58-
__import__(menu_module, fromlist=["menu"])
68+
__import__(menu_module, fromlist=["menu", ])
5969
except ImportError:
6070
pass
6171

0 commit comments

Comments
 (0)