Skip to content

Commit e17a0a9

Browse files
authored
Fix deprecation warning for menu (#154)
2 parents 13b19a4 + 6d0a25f commit e17a0a9

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ django-simple-menu changelog
33

44
Unreleased
55
- Test on Python 3.12
6+
- Fix deprecation notice appearing whe it shouldn't (#153)
67

78
Version 2.1.3 - Released October 4th, 2023
89
- Stop testing under Python 3.6, 3.7, and Django 4.0 (#138, #140)

menu/menu.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from simple_menu.menu import *
44

55
warnings.warn(
6-
"Importing from 'menu' will be removed in django-simple-menu v2.3 and/or "
7-
"v3.0. Use imports from 'simple_menu' package instead.",
6+
"Importing from 'menu' is deprecated. Import from 'simple_menu' instead. "
7+
"The old import will be removed in django-simple-menu v3, but no earlier "
8+
"than on 2024-04-01.",
89
DeprecationWarning,
910
stacklevel=2
1011
)

menu/templatetags/__init__.py

Whitespace-only changes.

menu/templatetags/menu.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
from simple_menu.templatetags.menu import *
1+
import warnings
2+
3+
from simple_menu.templatetags.simple_menu import *
4+
5+
warnings.warn(
6+
"Loading from 'menu' is deprecated. Use '{% load simple_menu %}' instead. "
7+
"The old template library will be removed in django-simple-menu v3, but "
8+
"no earlier than on 2024-04-01.",
9+
DeprecationWarning,
10+
stacklevel=2
11+
)

simple_menu/templatetags/menu.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

simple_menu/tests/test_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def test_template_tag(self):
217217
"""
218218
request = self.factory.get('/parent3/kids3-1')
219219
out = Template(
220-
"{% load menu %}"
220+
"{% load simple_menu %}"
221221
"{% generate_menu %}"
222222
"{% for item in menus.test %}"
223223
"{{ item.title }},"
@@ -240,7 +240,7 @@ def test_template_tag_missing_attribute(self):
240240
"""
241241
request = self.factory.get('/parent2/kids2-1')
242242
out = Template(
243-
"{% load menu %}"
243+
"{% load simple_menu %}"
244244
"{% generate_menu %}"
245245
"{% for item in menus.test %}"
246246
"{{ item.title }}{{ item.doesntexist }},"

0 commit comments

Comments
 (0)