diff --git a/basxbread/resources/project_template/project_name/settings/base.py-tpl b/basxbread/resources/project_template/project_name/settings/base.py-tpl index 52a920ab..ffc195b6 100644 --- a/basxbread/resources/project_template/project_name/settings/base.py-tpl +++ b/basxbread/resources/project_template/project_name/settings/base.py-tpl @@ -31,6 +31,17 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": os.path.join(BASE_DIR, "db.sqlite3"), + "OPTIONS": { + "transaction_mode": "IMMEDIATE", + "timeout": 5, # seconds + "init_command": """ + PRAGMA journal_mode=WAL; + PRAGMA synchronous=NORMAL; + PRAGMA mmap_size = 134217728; + PRAGMA journal_size_limit = 27103364; + PRAGMA cache_size=2000; + """, + }, } } diff --git a/basxbread/utils/urls.py b/basxbread/utils/urls.py index 3d8d7449..333ae63c 100644 --- a/basxbread/utils/urls.py +++ b/basxbread/utils/urls.py @@ -255,38 +255,63 @@ def default_model_paths( if browseview is not None: if browseview is True: browseview = defaultview["browse"] - ret.append( - autopath( - browseview.as_view(model=model), - model_urlname(model, "browse"), + if isinstance(browseview, type): + ret.append( + autopath( + browseview.as_view(model=model), + model_urlname(model, "browse"), + ) ) - ) + else: + ret.append(autopath(browseview, model_urlname(model, "browse"))) if readview is not None: if readview is True: readview = defaultview["read"] - ret.append( - autopath(readview.as_view(model=model), model_urlname(model, "read")) - ) + if isinstance(readview, type): + ret.append( + autopath(readview.as_view(model=model), model_urlname(model, "read")) + ) + else: + ret.append(autopath(readview, model_urlname(model, "read"))) if editview is not None: if editview is True: editview = defaultview["edit"] - ret.append( - autopath(editview.as_view(model=model), model_urlname(model, "edit")) - ) + if isinstance(editview, type): + ret.append( + autopath(editview.as_view(model=model), model_urlname(model, "edit")) + ) + else: + ret.append(autopath(editview, model_urlname(model, "edit"))) + if addview is not None: if addview is True: addview = defaultview["add"] - ret.append(autopath(addview.as_view(model=model), model_urlname(model, "add"))) + if isinstance(addview, type): + ret.append( + autopath(addview.as_view(model=model), model_urlname(model, "add")) + ) + else: + ret.append(autopath(addview, model_urlname(model, "add"))) + if deleteview is not None: if deleteview is True: deleteview = defaultview["delete"] - ret.append( - autopath(deleteview.as_view(model=model), model_urlname(model, "delete")) - ) + if isinstance(deleteview, type): + ret.append( + autopath( + deleteview.as_view(model=model), model_urlname(model, "delete") + ) + ) + else: + ret.append(autopath(deleteview, model_urlname(model, "delete"))) + if copyview is not None: if copyview is True: copyview = generate_copyview(model) - ret.append(autopath(copyview, model_urlname(model, "copy"))) + if isinstance(copyview, type): + ret.append(autopath(copyview, model_urlname(model, "copy"))) + else: + ret.append(autopath(copyview, model_urlname(model, "copy"))) for viewname, view in kwargs.items(): if isinstance(view, type):