Django Version Viewer
Version Viewer provides Django Admins (with appropriate permission) the ability to view the Python packages and versions used within the project.
This tool can be used in several ways. It provides:
- a template tag which inserts a link onto a template. Clicking that link opens up a pop up modal displaying installed Python packages.
- a DjangoCMS toolbar entry. When clicked, a popup will display installed Python packages.
- a CSV export of installed Python packages.
- a queryable endpoint that displays installed Python packages.
You may also configure which users have access to the link and endpoint.
Installation
To install the Django Version Viewer, simply:
pip install django-version-viewer
Add the following to INSTALLED_APPS in settings.py
INSTALLED_APPS = [
'django_version_viewer'
]
Add django_version_viewer urls and extend admin/index.html
Django Version Viewer needs to extend the admin/index.html and append it's urls to your urls.py. In your urls.py add:
admin.site.index_template = 'admin/custom_index.html'
admin.autodiscover()
urlpatterns = [
...
path('django_version_viewer/', include('django_version_viewer.urls')),
...
]
# Note that you can now make a GET request to the route `r'^django_version_viewer/'` to see
# a list of your app's installed pip dependencies returned in JSON.
In your templates/admin/ dir, create a custom_index.html.
<!-- custom_index.html -->
{% extends "admin/index.html" %}
{% load i18n pip_version_viewer_tags %}
{% block content %}
{% show_pip_package_versions %}
{{ block.super }}
{% endblock %}
Django CMS integration
If Django CMS is installed, a new menu item will be added to the CMS Toolbar Page Menu that will allow opening the version viewer popup.
Permissions
You can set your own access permissions on the template tag and route by
defining your own Accessor class. This class must have a allow_access
method that returns a boolean. By defualt, django_version_viewer only
allows superusers access to the route and template tag.
# Django Version Viewer settings:
ACCESSOR_CLASS_PATH = 'mypathto.my.AccessorClass'
# the default class only allows superusers access
django_version_viewer.mixins.SuperuserAccessor
Running Tests
# in a virtualenv
pip install -e .[testing]
pip install Django==5.2.14
flake8 .
ENABLE_DJANGOCMS=False coverage run ./example22/manage.py test django_version_viewer
Release files for django-version-viewer 2.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_version_viewer-2.1.9.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_version_viewer-2.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / django_version_viewer-2.1.9.tar.gz
| Download URL | django_version_viewer-2.1.9.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c75fbb59d09b8fa02823603ac71a2f8d85304020d0eadbf698582c8d49297222
|
|
BLAKE2b-256 checksum How to use checksums |
a26b597c32b4925f6ecb5620526635c8a385fac5c49685b7318cb30a54105004
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / django_version_viewer-2.1.9-py3-none-any.whl
| Download URL | django_version_viewer-2.1.9-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6daf68b48045126f4099b5ccb35ef6443c1c9606cd840b177a52ad7b591c3df
|
|
BLAKE2b-256 checksum How to use checksums |
967991140ef5211fd2dea1bfb6e54a61cafc0b51197d71240fe4e0796122a3a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|