45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import shutil
|
|
from pathlib import Path
|
|
|
|
from django.conf import settings
|
|
from django.urls import path
|
|
|
|
from project.main import views
|
|
|
|
urlpatterns = [
|
|
path("", views.HomeView.as_view(), name="home"),
|
|
path("swap", views.SwapView.as_view(), name="swap"),
|
|
path("filter-list", views.FilterListView.as_view(), name="filter-list"),
|
|
path(
|
|
"filter-list/filter", views.FilterListFilterView.as_view(), name="filter-list-filter"
|
|
),
|
|
path("form-validation", views.FormValidationView.as_view(), name="form-validation"),
|
|
path("complex-form", views.ComplexFormView.as_view(), name="complex-form"),
|
|
path(
|
|
"complex-form/handle/route-module",
|
|
views.RouteModuleHandleView.as_view(),
|
|
name="complex-form-handle-route-module",
|
|
),
|
|
path(
|
|
"complex-form/handle/reports",
|
|
views.ReportsHandleView.as_view(),
|
|
name="complex-form-handle-reports",
|
|
),
|
|
path(
|
|
"complex-form/handle/warehouse-management",
|
|
views.WarehouseManagementHandleView.as_view(),
|
|
name="complex-form-handle-warehouse-management",
|
|
),
|
|
path(
|
|
"table-inline-edit",
|
|
views.TableInlineEditView.as_view(),
|
|
name="table-inline-edit",
|
|
),
|
|
]
|
|
|
|
# check if db exists, and copy from template if not
|
|
if not Path.exists(settings.DATABASES["default"]["NAME"]):
|
|
template_filename = settings.BASE_DIR / "db.template.sqlite3"
|
|
shutil.copyfile(template_filename, settings.DATABASES["default"]["NAME"])
|
|
print("Database copied from template.")
|