-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from PacificGilly/jamesgilmore/fix-version-id…
…entifier Fix displaying the installed version of Django-Jazzmin in the UI.
- Loading branch information
Showing
4 changed files
with
63 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
import django | ||
import sys | ||
|
||
# We automatically grab the version of `django-jazzmin` from the package manager instead of | ||
# hard coding it. The method for determining the version changed since PY3.8. N.B. For | ||
# development versions of `django-jazzmin`, the version will be 0.0.0 (see pyproject.toml) as it's | ||
# not technically installed. | ||
if sys.version_info >= (3, 8): | ||
from importlib.metadata import version as package_version | ||
|
||
version = package_version("django-jazzmin") | ||
else: | ||
import pkg_resources | ||
|
||
version = pkg_resources.get_distribution("django-jazzmin").version | ||
|
||
version = "2.6.1" | ||
|
||
if django.VERSION < (3, 2): | ||
default_app_config = "jazzmin.apps.JazzminConfig" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import jazzmin | ||
|
||
|
||
def test_version(): | ||
""" | ||
Tests getting the version of the installed package in all versions of Python we support. | ||
""" | ||
assert jazzmin.version >= "0.0.0" |