Compare commits
5 Commits
8f6f226654
...
ebb48c1a42
Author | SHA1 | Date | |
---|---|---|---|
|
ebb48c1a42 | ||
23cb231bdc | |||
9381b3021f | |||
bd19684ef8 | |||
a5e895f9ad |
@ -11,3 +11,8 @@ The AHosking.com API
|
|||||||
1. Activate environment
|
1. Activate environment
|
||||||
`.\.env\Scripts\activate`
|
`.\.env\Scripts\activate`
|
||||||
1.
|
1.
|
||||||
|
|
||||||
|
|
||||||
|
### Third-party
|
||||||
|
|
||||||
|
* https://pypi.org/project/django-3-jet/
|
@ -4,5 +4,26 @@
|
|||||||
"path": "."
|
"path": "."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {}
|
"settings": {
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"activityBar.activeBackground": "#fbed80",
|
||||||
|
"activityBar.activeBorder": "#06b9a5",
|
||||||
|
"activityBar.background": "#fbed80",
|
||||||
|
"activityBar.foreground": "#15202b",
|
||||||
|
"activityBar.inactiveForeground": "#15202b99",
|
||||||
|
"activityBarBadge.background": "#06b9a5",
|
||||||
|
"activityBarBadge.foreground": "#15202b",
|
||||||
|
"sash.hoverBorder": "#fbed80",
|
||||||
|
"statusBar.background": "#f9e64f",
|
||||||
|
"statusBar.foreground": "#15202b",
|
||||||
|
"statusBarItem.hoverBackground": "#f7df1e",
|
||||||
|
"statusBarItem.remoteBackground": "#f9e64f",
|
||||||
|
"statusBarItem.remoteForeground": "#15202b",
|
||||||
|
"titleBar.activeBackground": "#f9e64f",
|
||||||
|
"titleBar.activeForeground": "#15202b",
|
||||||
|
"titleBar.inactiveBackground": "#f9e64f99",
|
||||||
|
"titleBar.inactiveForeground": "#15202b99"
|
||||||
|
},
|
||||||
|
"peacock.color": "#f9e64f"
|
||||||
|
}
|
||||||
}
|
}
|
34
api/api/dashboard.py
Normal file
34
api/api/dashboard.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from jet.dashboard import modules
|
||||||
|
from jet.dashboard.dashboard import Dashboard, AppIndexDashboard
|
||||||
|
|
||||||
|
|
||||||
|
class CustomIndexDashboard(Dashboard):
|
||||||
|
# app_label = "api"
|
||||||
|
|
||||||
|
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
|
||||||
|
))
|
@ -29,13 +29,15 @@ SECRET_KEY = env("SECRET_KEY", default='django-insecure-7uajhmbt^@)mklk1ur=slkmn
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = env("DEBUG")
|
DEBUG = env("DEBUG")
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["127.0.0.1", "192.168.1.187", "192.168.1.23"]
|
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "192.168.1.187", "192.168.1.23"]
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'jet.dashboard',
|
||||||
'jet',
|
'jet',
|
||||||
|
'bills.apps.BillsConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
@ -45,7 +47,6 @@ INSTALLED_APPS = [
|
|||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'django_filters',
|
'django_filters',
|
||||||
'bills.apps.BillsConfig',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@ -136,3 +137,40 @@ STATIC_URL = '/static/'
|
|||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
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'
|
@ -24,7 +24,10 @@ urlpatterns = [
|
|||||||
# url(r'^$', view=TemplateView.as_view(template_name='bills/home.html')),
|
# url(r'^$', view=TemplateView.as_view(template_name='bills/home.html')),
|
||||||
# url(r'^$', view=TemplateView.as_view(template_name='main_api/home.html')),
|
# url(r'^$', view=TemplateView.as_view(template_name='main_api/home.html')),
|
||||||
path('', views.index, name='index'),
|
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/', include('jet.urls', 'jet')),
|
||||||
|
path('jet/dashboard', include('jet.dashboard.urls', 'jet-dashboard')),
|
||||||
path('bills/', include('bills.urls')),
|
path('bills/', include('bills.urls')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
@ -2,4 +2,8 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import Bill
|
from .models import Bill
|
||||||
|
|
||||||
admin.site.register(Bill)
|
@admin.register(Bill)
|
||||||
|
class BillAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['name', 'due', 'amount']
|
||||||
|
list_filter = ('name', 'type', 'is_paid', 'is_overdue', 'is_missed')
|
||||||
|
search_fields = ['name', 'type', 'amount']
|
48
api/bills/migrations/0004_auto_20211203_1549.py
Normal file
48
api/bills/migrations/0004_auto_20211203_1549.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
@ -2,14 +2,14 @@ from django.db import models
|
|||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Bill(models.Model):
|
class Bill(models.Model):
|
||||||
name = models.CharField(max_length=64)
|
name = models.CharField(max_length=64, verbose_name='Name')
|
||||||
type = models.CharField(max_length=64)
|
type = models.CharField(max_length=64, verbose_name="Type")
|
||||||
due = models.DateField('due_date')
|
due = models.DateField(verbose_name="Due Date")
|
||||||
amount = models.FloatField(default='00.00')
|
amount = models.FloatField(default='00.00')
|
||||||
is_paid = models.BooleanField(default=False)
|
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)
|
is_overdue = models.BooleanField(default=False, verbose_name="Overdue")
|
||||||
is_missed = models.BooleanField(default=False)
|
is_missed = models.BooleanField(default=False, verbose_name='Missed Payment')
|
||||||
|
|
||||||
def overdue(self):
|
def overdue(self):
|
||||||
return self.is_overdue
|
return self.is_overdue
|
||||||
|
@ -8,5 +8,6 @@ from . import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
path('admin/', admin.site.urls),
|
path('<int:bill_id>/', views.detail, name='detail')
|
||||||
|
# path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
@ -3,4 +3,6 @@ from django.http import HttpResponse
|
|||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("Let there be bills!")
|
return HttpResponse("Let there be bills!")
|
||||||
# Create your views here.
|
|
||||||
|
def detail(request, bill_id):
|
||||||
|
return HttpResponse("You're looking at Bill %s." % bill_id)
|
||||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
Reference in New Issue
Block a user