Skip to main content

Django app for viewing python packages and their versions

Project description

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 = [
    ...
    url(r'^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 %}

Admin Integration

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.

CMS Integration

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==2.2.27
flake8 .
ENABLE_DJANGOCMS=False coverage run ./example22/manage.py test django_version_viewer

Using the Example Project

An example project is provided to demonstrate the project.

# in a virtualenv
cd example22/
pip install -r requirements.txt
./manage.py migrate
./manage.py createsuperuser
./manage.py runserver

# Run without DjangoCMS
ENABLE_DJANGOCMS=False ./manage.py runserver

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_version_viewer-2.1.8.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

django_version_viewer-2.1.8-py2.py3-none-any.whl (12.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_version_viewer-2.1.8.tar.gz.

File metadata

  • Download URL: django_version_viewer-2.1.8.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/6.5.0-35-generic

File hashes

Hashes for django_version_viewer-2.1.8.tar.gz
Algorithm Hash digest
SHA256 50144f81f16ddb74c8e1a395d1be4b53ec25b86ae8bb6f0b5b6fa1bc1ef01807
MD5 8fc560dcf81c7d133ac1b09b4bfd5001
BLAKE2b-256 6fccd1875b58838ec543573927e0c31708bee78a139453a0c3e2dd4a9b316fcb

See more details on using hashes here.

File details

Details for the file django_version_viewer-2.1.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_version_viewer-2.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77434635f05152ca03f002ac69bc44f7dc6ff19842947d55e1d432cdce1a8a1e
MD5 246cee283d05a0caa786aff28ac5ea5d
BLAKE2b-256 7718776e5806bbce3ab4ee3603bb44649641ac08099981102e3f3da1ed262852

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page