Code Monkey home page Code Monkey logo

django-pygwalker's Introduction

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

django-pygwalker's People

Contributors

davidslusser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lomntetha

django-pygwalker's Issues

Cannot find "base.htm"

I'm trying to use the generic pygwalker view (users upload CSV), and I'm getting a template error; cannot find "base.htm"

I'm relatively new to Django, so I apologize if I'm missing an obvious step, but I've looked through the source files and I cannot find a "base.htm" anywhere outside of the /tests/ directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.