Django Admin with Vali theme
Project description
Django Admin Vali
Note
This project is based in django-vali project from cnanyi
https://github.com/cnanyi/django-vali.
Overview
Administrator
- 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
-
Site:
- url:
/admin
- Page with administrator access.
- url:
/admin/dashboard
- Page with dashboard access.
Extra
This project allows you to use i18n in urls https://docs.djangoproject.com/en/2.0/topics/i18n/.
- url:
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 use Dashboard, include 'vali'
to your urls.py
setting.
urlpatterns = (
...
path('admin/', include(('vali.urls','vali'), namespace='dashboard')),
...
)
In your settings, add VALI_CONFIG
.
VALI_CONFIG = {
'theme': 'default',
'dashboard': {
'name': 'Dashboard',
'url': '/admin/dashboard/',
'subtitle': 'Dashboard view with all statistics',
'site_name': 'Dashboard admin',
'url_image_profile': ''
},
'applist': {
"order": "registry", "group": True
},
}
Usage
Note
You can use the model that you want.
In your 'counters.py'
add ...
from vali.counters import CounterBase
from .models import Messages
class MessagesCounter(CounterBase):
title = 'Title goes here'
def get_value(self, request):
return Messages.objects.count()
or
from vali.counters import ModelCounter
from .models import Messages
class MessagesCounter(ModelCounter):
model = Messages
In your 'charts.py'
add ...
from vali.charts import ModelCharts
from .models import Messages
class ChartCounter(ModelCharts):
model = Messages
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 MessagesCounter
from .charts import ChartCounter
from vali.views import ValiDashboardBase
class MessagesDashboardView(ValiDashboardBase):
template_name = 'dashboard.html'
list_counters = [
MessagesCounter(),
]
list_charts = [
ChartCounter(),
]
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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.1.5.tar.gz
(510.2 kB
view hashes)
Built Distribution
Close
Hashes for django_admin_vali-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d60b45445688a47ff01953e1e3cf1f92218fe8bc72168ef4327ef17cbf0aabd |
|
MD5 | fae5d8081c38ef8e94d319b100b9e3ed |
|
BLAKE2b-256 | e3136067a916437e822e105a2033bd35478c0c4808cf94b97c1d0710b14c78b4 |