Start frontend implementation

Implement base template handling, views
This commit is contained in:
Kumi 2023-04-22 14:18:58 +00:00
parent 045fd0c73f
commit 6799a96334
Signed by: kumi
GPG key ID: ECBCC9082395383F
8 changed files with 40 additions and 8 deletions

14
core/urls.py Normal file
View file

@ -0,0 +1,14 @@
from django.urls import path
from django.conf import settings
from .views import (
CustomerDashboardView,
BaseTestView,
)
urlpatterns = [
path('manager/dashboard/', CustomerDashboardView.as_view(), name='dashboard'),
]
if settings.DEBUG:
urlpatterns.append(path('test/base/', BaseTestView.as_view(), name='base'))

View file

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

2
core/views/__init__.py Normal file
View file

@ -0,0 +1,2 @@
from .test import BaseTestView
from .customers import CustomerDashboardView

10
core/views/customers.py Normal file
View file

@ -0,0 +1,10 @@
from django.views.generic import TemplateView
class CustomerDashboardView(TemplateView):
template_name = 'manager/customer/dashboard.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['app_title'] = "Restoroo"
context['page_title'] = "Dashboard"
return context

4
core/views/test.py Normal file
View file

@ -0,0 +1,4 @@
from django.views.generic import TemplateView
class BaseTestView(TemplateView):
template_name = 'manager/base.html'

@ -1 +1 @@
Subproject commit e117a67e55ec78cbee83e9fd6ea799982a3cb22e Subproject commit c21addaf262b948bf828b8bfc129160277c5dd8b

View file

@ -75,19 +75,23 @@ WSGI_APPLICATION = 'restoroo.wsgi.application'
if "MySQL" in CONFIG_FILE.config: if "MySQL" in CONFIG_FILE.config:
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.contrib.gis.db.backends.mysql',
'NAME': CONFIG_FILE.config.get("MySQL", "Database"), 'NAME': CONFIG_FILE.config.get("MySQL", "Database"),
'USER': CONFIG_FILE.config.get("MySQL", "Username"), 'USER': CONFIG_FILE.config.get("MySQL", "Username"),
'PASSWORD': CONFIG_FILE.config.get("MySQL", "Password"), 'PASSWORD': CONFIG_FILE.config.get("MySQL", "Password"),
'HOST': CONFIG_FILE.config.get("MySQL", "Host", fallback="localhost"), 'HOST': CONFIG_FILE.config.get("MySQL", "Host", fallback="localhost"),
'PORT': CONFIG_FILE.config.getint("MySQL", "Port", fallback=3306) 'PORT': CONFIG_FILE.config.getint("MySQL", "Port", fallback=3306),
'OPTIONS': {
'charset': 'utf8mb4',
'sql_mode': 'traditional',
}
} }
} }
else: else:
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.contrib.gis.db.backends.spatialite',
'NAME': BASE_DIR / 'db.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3',
} }
} }

View file

@ -14,7 +14,8 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include('core.urls')),
] ]