Skip to main content

PyGWalker views for Django projects

Project description

django-pygwalker

Downloads

Maintainability OpenSSF Best Practices

PyPI - Python PyPI - Django

This utility creates user interfaces for visual analysis using PyGWalker in your django application. A PyGWalker page can be created from a Django queryset, a static csv file, or an uploaded csv file.

For more information on PyGWalker see the github repo available here: https://github.com/Kanaries/pygwalker


Code Quality

Workflow Description Status
Bandit security checks Bandit
Black code formatting Black
CodeQL security analysis CodeQL
Coveralls code coverage status Coveralls
Isort python import ordering Isort
Mypy static type checking Mypy
Pytest unit testing Pytest
Radon code complexity analysis Radon
Ruff static code analysis Ruff
Safety dependency scanner Saftey
Tox python/django versions testing Tox

Code Coverage

Coverage Status

Dashboard: https://coveralls.io/github/djangoaddicts/django-pygwalker


Documentation

Documentation Status

Full documentation can be found on http://django-pygwalker.readthedocs.org.

Documentation source files are available in the docs folder.


Installation

  • install via pip:

    pip install django-pygwalker
    
  • add the following to your INSTALLED_APPS in settings.py:

    djangoaddicts.pygwalker
    

    NOTE: adding djangoaddicts.pygwalker to INSTALLED_APPS is only required if you intend to use the built-in templates or the 'generic' PyGWalker view.

  • to include the generic PyGWalker view (creates the PyGWalker page from an upload of a csv file) add the following to your project-level urls.py:

    path("pygwalker/", include("djangoaddicts.pygwalker.urls"), ),
    

Features

PygWalkerView

The PygWalkerView renders a page containing PyGWalker html. This view takes a queryset parameter and includes all data in the queryset for visualizations. By default fields defined in the model will be included. To exclude fields or include additional fields (such as related fields), use the field_list parameter to specify exact fields desired for visualizations.

A Bootstrap 5 template is included, but can be overwritten using the template_name parameter.

Parameters

  • field_list: list of model fields to include (defaults to fields defined in the model)
  • queryset: queryset providing data available to visualization
  • theme: PyGWalker theme to use for pyg html (defaults to "media")
  • title: title used on html render
  • template_name: template used when rendering page; (defaults to pygwalker/bs5/pygwalker.html)

Usage Examples

from djangoaddicts.pygwalker.views import PygWalkerView

class MyPygWalkerView(PygWalkerView):
    queryset = MyModel.objects.all()

Explicitly Defined Fields

from djangoaddicts.pygwalker.views import PygWalkerView

class MyPygWalkerView(PygWalkerView):
    queryset = MyModel.objects.all()
    title = "MyModel Data Analysis"
    theme = "light"
    field_list = ["name", "some_field", "some_other__related_field", "id", "created_at", "updated_at"]

Custom Template

Custom views/templates can be used to override the Bootstrap 5 templates provided by default view. Here is an example:

from djangoaddicts.pygwalker.views import PygWalkerView

class MyPygWalkerView(PygWalkerView):
    queryset = MyModel.objects.all()
    template_name = "my_custom_template.html"

License

django-pygwalker is licensed under the GNU-3 license (see the LICENSE file for details).

https://github.com/djangoaddicts/django-pygwalker/blob/main/LICENSE


Contributing

To contribute to django-pygwalker, please see Contributing

Project details


Download files

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

Source Distribution

django-pygwalker-0.0.8.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_pygwalker-0.0.8-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file django-pygwalker-0.0.8.tar.gz.

File metadata

  • Download URL: django-pygwalker-0.0.8.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for django-pygwalker-0.0.8.tar.gz
Algorithm Hash digest
SHA256 d4ce480b7a63faaae44729ad04cdc17575bffbcb6eb57789330ca24ade8fa938
MD5 206635d2d4ddc64736fa00595be887c6
BLAKE2b-256 9d0b22360456ae9d5c27db57c26858754bda0f614f24adacd0fd022ade037886

See more details on using hashes here.

File details

Details for the file django_pygwalker-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for django_pygwalker-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c6baec3a882bca0b713ae00063d25ecaed69d1bb3b12f57911ff893f64e1f8
MD5 287efc48820ca0adeb0aefc7af2932c8
BLAKE2b-256 c265cf37591657cdab93152db6bd2a0cfbdc1d2fe2b593d7ea79bd6c53e5708a

See more details on using hashes here.

Supported by

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