feat(settings): new module for whole of application settings/globals

!10
This commit is contained in:
2024-05-23 19:10:08 +09:30
parent 88f1007a74
commit ac233e432f
11 changed files with 95 additions and 4 deletions

View File

@ -46,6 +46,7 @@ INSTALLED_APPS = [
'core.apps.CoreConfig',
'access.apps.AccessConfig',
'itam.apps.ItamConfig',
'settings.apps.SettingsConfig',
]
MIDDLEWARE = [

View File

@ -19,11 +19,11 @@ from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path
from .views import HomeView
from .views import home
from core.views import history
urlpatterns = [
path('', HomeView.as_view(), name='home'),
path('', home.HomeView.as_view(), name='home'),
path('admin/', admin.site.urls, name='_administration'),
path('account/password_change/', auth_views.PasswordChangeView.as_view(template_name="password_change.html.j2"),
name="change_password"),
@ -48,3 +48,10 @@ if settings.DEBUG:
# Apps Under Development
path("information/", include("information.urls")),
]
# must be after above
urlpatterns += [
path("settings/", include("settings.urls")),
]

0
app/settings/__init__.py Normal file
View File

6
app/settings/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class SettingsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'settings'

View File

View File

@ -0,0 +1,49 @@
{% extends 'base.html.j2' %}
{% block content%}
<style>
div#content {
/*background-color: blue;*/
vertical-align: top;
width: auto;
margin: 10px;
padding: 10px;
text-align: center;
display: flex;
}
div#content article {
/*background-color: brown;*/
width: 47%;
display: flexbox;
position: relative;
text-align: left;
align-self: top;
}
div#content article h3 {
text-align: center;
padding: 0px;
margin: 0px;
}
</style>
<div id="content" style="">
<article style="">
<h3>ITAM</h3>
<ul>
<li><a href="{% url 'Settings:_device_types' %}">Device Types</a></li>
<li><a href="">Manufacturers / Publishers</a></li>
<li><a href="">Models</a></li>
<li><a href="{% url 'Settings:_software_categories' %}">Software Categories</a></li>
</ul>
</article>
</div>
{% endblock %}

10
app/settings/urls.py Normal file
View File

@ -0,0 +1,10 @@
from django.urls import path
from .views import home
app_name = "Settings"
urlpatterns = [
path("", home.View.as_view(), name="Settings"),
]

View File

View File

@ -0,0 +1,18 @@
import requests
from django.conf import settings
from django.shortcuts import redirect, render
from django.views.generic import View
class View(View):
template_name = 'settings/home.html.j2'
def get(self, request):
context = {}
context['content_title'] = 'Settings'
return render(request, self.template_name, context)

View File

@ -69,9 +69,11 @@ section h2 span svg {
{% endblock %}
{% endif %}
</h2>
{% block content %}
<article>
{% block body%}{% endblock %}
</article>
{% endblock %}
<footer>{% block footer%}{% endblock %}</footer>
</section>

View File

@ -1,7 +1,5 @@
{% extends 'base.html.j2' %}
{% block title %}Home{% endblock %}
{% block body%}