Skip to main content

Django Admin with Vali theme

Project description

Django Admin Vali

GitHub version Open Source Love

This project is based in django-vali project from cnanyi
https://github.com/cnanyi/django-vali.

Overview

Dashboard Administration

  • User who has permission to access the dashboard.
  • Can view all log entries.
  • Can view all dynamics data.

Requirements

  • django >= 2.0
  • python >= 3.0

Routes

  • url: /admin → Page with administrator access.
  • url: /admin/dashboard → Page with dashboard access.

Extra This project allows you to use i18n in urls. See more in Django Website.

Installation

Install using pip...

    $ pip install django-admin-vali

Add vali to your INSTALLED_APPS setting before django.contrib.admin.

    INSTALLED_APPS = (
        ...
        'vali',
        'django.contrib.admin',
        ...
    )

If you want to use Vali Dashboard, include vali.urls to your urls.py file.

    urlpatterns = (
        ...
        path('admin/', include(('vali.urls','vali'), namespace='dashboard')),
        ...
    )

In your settings, add VALI_CONFIG to enable dashboard view, change theme and get responsive permission fields.

    VALI_CONFIG = {
        'theme': 'default',
        'dashboard': {
            'name': 'Dashboard',
            'url': '/admin/dashboard/',
            'subtitle': 'Dashboard view with all statistics',
            'site_name': 'Dashboard admin',
            'url_image_profile': ''
        },
        'fieldset': {
            'fields': ['user_permissions', 'permissions']
        },
        'applist': {
            'order': "registry", "group": True
        }
    }  

To change the theme, just choose one of this: default, green, brown, blue, purple or create your own.

Usage

In your counters.py add ...

    from vali.counters import CounterBase
    from .models import Model

    class MyModelCounter(CounterBase):
        title = 'Title goes here'

        def get_value(self, request):
            return Model.objects.count()  

or

    from vali.counters import ModelCounter
    from .models import Model

    class MyModelCounter(ModelCounter):
        model = Model  

In your charts.py add ...

    from vali.charts import ModelCharts
    from .models import Model


    class ChartCounter(ModelCharts):
        model = Model
        chart_type = 'Bar'
        name = 'barchart1'
        labels = ["2018-03-01", "2018-03-02", "2018-03-03", "2018-03-04", "2018-03-05"]
        datasets = [
            {
                "label": "dataset 1",
                "fillColor": "rgba(220,220,220,0.2)",
                "strokeColor": "rgba(220,220,220,1)",
                "pointColor": "rgba(220,220,220,1)",
                "pointStrokeColor": "#fff",
                "pointHighlightFill": "#fff",
                "pointHighlightStroke": "rgba(220,220,220,1)",
                "data": [65, 59, 80, 81, 80]
            },
            {
                "label": "dataset 2",
                "fillColor": "rgba(151,187,205,0.2)",
                "strokeColor": "rgba(151,187,205,1)",
                "pointColor": "rgba(151,187,205,1)",
                "pointStrokeColor": "#fff",
                "pointHighlightFill": "#fff",
                "pointHighlightStroke": "rgba(151,187,205,1)",
                "data": [28, 48, 40, 19, 69]
            }
        ]  

In your views.py add ...

from .counters import MyModelCounter
from .charts import ChartCounter
from vali.views import ValiDashboardBase


class ModelDashboardView(ValiDashboardBase):
    template_name = 'dashboard.html'

    list_counters = [
        MyModelCounter(),
    ]   
    list_charts = [
        ChartCounter(),
    ]

License

This project is licensed under the MIT License.

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-admin-vali-0.2.2.tar.gz (515.3 kB view details)

Uploaded Source

Built Distribution

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

django_admin_vali-0.2.2-py3-none-any.whl (543.6 kB view details)

Uploaded Python 3

File details

Details for the file django-admin-vali-0.2.2.tar.gz.

File metadata

  • Download URL: django-admin-vali-0.2.2.tar.gz
  • Upload date:
  • Size: 515.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for django-admin-vali-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f59e44a023a5799de48b349964177b9deca5d3421b3445faad9a1772e0ae0aaf
MD5 921d6717935319995db9d808159e9826
BLAKE2b-256 c6317f2dacff7ee26c0ff6f967e6b1f9434cf31b3eb6140f88228f038efd3808

See more details on using hashes here.

File details

Details for the file django_admin_vali-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: django_admin_vali-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 543.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for django_admin_vali-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6d939f38684508321bf221332ad1f7a8c9541195ea2e26ceaaf9921a3c52ea8e
MD5 2561ac5a7a9b039d78d934a91463f74f
BLAKE2b-256 4c4ad9dba58f5c7fab47969bf3a189dbc8dd6b2306b172a9aabe09b340f22a34

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