Adds migrations and jet dashboards

This commit is contained in:
Alexander Hosking 2021-12-03 16:44:19 -05:00
parent bd19684ef8
commit 9381b3021f
5 changed files with 121 additions and 2 deletions

32
api/api/dashboard.py Normal file
View File

@ -0,0 +1,32 @@
from django.utils.translation import ugettext_lazy as _
from jet.dashboard import modules
from jet.dashboard.dashboard import Dashboard, AppIndexDashboard
class CustomIndexDashboard(Dashboard):
columns = 3
def init_with_context(self, context):
self.available_children.append(modules.LinkList)
self.children.append(modules.LinkList(
_('Support'),
children=[
{
'title': _('Django documentation'),
'url': 'http://docs.djangoproject.com/',
'external': True,
},
{
'title': _('Django "django-users" mailing list'),
'url': 'http://groups.google.com/group/django-users',
'external': True,
},
{
'title': _('Django irc channel'),
'url': 'irc://irc.freenode.net/django',
'external': True,
},
],
column=0,
order=0
))

View File

@ -37,6 +37,7 @@ ALLOWED_HOSTS = ["127.0.0.1", "192.168.1.187", "192.168.1.23"]
INSTALLED_APPS = [
'jet.dashboard',
'jet',
'bills.apps.BillsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@ -46,7 +47,6 @@ INSTALLED_APPS = [
'rest_framework',
'rest_framework.authtoken',
'django_filters',
'bills.apps.BillsConfig',
]
MIDDLEWARE = [
@ -137,3 +137,40 @@ STATIC_URL = '/static/'
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
JET_THEMES = [
{
'theme': 'default', # theme folder name
'color': '#47bac1', # color of the theme's button in user menu
'title': 'Default' # theme title
},
{
'theme': 'green',
'color': '#44b78b',
'title': 'Green'
},
{
'theme': 'light-green',
'color': '#2faa60',
'title': 'Light Green'
},
{
'theme': 'light-violet',
'color': '#a464c4',
'title': 'Light Violet'
},
{
'theme': 'light-blue',
'color': '#5EADDE',
'title': 'Light Blue'
},
{
'theme': 'light-gray',
'color': '#222',
'title': 'Light Gray'
}
]
# JET_INDEX_DASHBOARD = 'jet.dashboard.dashboard.DefaultIndexDashboard'
JET_APP_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'
# JET_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'

View File

@ -24,6 +24,8 @@ urlpatterns = [
# url(r'^$', view=TemplateView.as_view(template_name='bills/home.html')),
# url(r'^$', view=TemplateView.as_view(template_name='main_api/home.html')),
path('', views.index, name='index'),
# url(r'^jet/', include('jet.urls', 'jet')), # Django JET URLS
# url(r'^jet/dashboard/', include('jet.dashboard.urls', 'jet-dashboard')),
path('jet/', include('jet.urls', 'jet')),
path('jet/dashboard', include('jet.dashboard.urls', 'jet-dashboard')),
path('bills/', include('bills.urls')),

View File

@ -0,0 +1,48 @@
# Generated by Django 3.2.9 on 2021-12-03 20:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bills', '0003_alter_bill_paid_date'),
]
operations = [
migrations.AlterField(
model_name='bill',
name='due',
field=models.DateField(verbose_name='Due Date'),
),
migrations.AlterField(
model_name='bill',
name='is_missed',
field=models.BooleanField(default=False, verbose_name='Missed Payment'),
),
migrations.AlterField(
model_name='bill',
name='is_overdue',
field=models.BooleanField(default=False, verbose_name='Overdue'),
),
migrations.AlterField(
model_name='bill',
name='is_paid',
field=models.BooleanField(default=False, verbose_name='Paid'),
),
migrations.AlterField(
model_name='bill',
name='name',
field=models.CharField(max_length=64, verbose_name='Name'),
),
migrations.AlterField(
model_name='bill',
name='paid_date',
field=models.DateField(blank=True, null=True, verbose_name='Paid Date'),
),
migrations.AlterField(
model_name='bill',
name='type',
field=models.CharField(max_length=64, verbose_name='Type'),
),
]

View File

@ -7,7 +7,7 @@ class Bill(models.Model):
due = models.DateField(verbose_name="Due Date")
amount = models.FloatField(default='00.00')
is_paid = models.BooleanField(default=False, verbose_name="Paid")
paid_date = models.DateField('paid_date',null=True, blank=True)
paid_date = models.DateField('Paid Date',null=True, blank=True)
is_overdue = models.BooleanField(default=False, verbose_name="Overdue")
is_missed = models.BooleanField(default=False, verbose_name='Missed Payment')