diff --git a/apps/cmdb/__init__.py b/apps/cmdb/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/cmdb/admin.py b/apps/cmdb/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/cmdb/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/cmdb/apps.py b/apps/cmdb/apps.py new file mode 100644 index 0000000..9e8f468 --- /dev/null +++ b/apps/cmdb/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CmdbConfig(AppConfig): + name = 'cmdb' diff --git a/apps/cmdb/migrations/__init__.py b/apps/cmdb/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/cmdb/models.py b/apps/cmdb/models.py new file mode 100644 index 0000000..f231cf1 --- /dev/null +++ b/apps/cmdb/models.py @@ -0,0 +1,22 @@ +from django.db import models + +# Create your models here. + + +class AbstractMode(models.Model): + parent = models.ForeignKey( + 'self', blank=True, null=True, on_delete=models.SET_NULL, related_name='child' + ) + + class Meta: + abstract = True + + +class Code(AbstractMode): + key = models.CharField(max_length=80, verbose_name='键') + value = models.CharField(max_length=80, verbose_name='值') + desc = models.BooleanField(default=True, verbose_name='备注') + + class Meta: + verbose_name = '字典' + verbose_name_plural = verbose_name diff --git a/apps/cmdb/tests.py b/apps/cmdb/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/cmdb/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/cmdb/urls.py b/apps/cmdb/urls.py new file mode 100644 index 0000000..7cbc875 --- /dev/null +++ b/apps/cmdb/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from .views import CmdbView + +app_name = 'cmdb' + +urlpatterns = [ + path('', CmdbView.as_view(), name='index'), +] diff --git a/apps/cmdb/views.py b/apps/cmdb/views.py new file mode 100644 index 0000000..ac3e598 --- /dev/null +++ b/apps/cmdb/views.py @@ -0,0 +1,9 @@ +from django.views.generic import TemplateView + +from system.mixin import LoginRequiredMixin +from custom import BreadcrumbMixin + + +class CmdbView(LoginRequiredMixin, BreadcrumbMixin, TemplateView): + + template_name = 'cmdb/cmdb_index.html' diff --git a/sandboxMP/settings.py b/sandboxMP/settings.py index 7810c11..a4f734f 100644 --- a/sandboxMP/settings.py +++ b/sandboxMP/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'system', + 'cmdb', ] MIDDLEWARE = [ diff --git a/sandboxMP/urls.py b/sandboxMP/urls.py index d3ae5f7..8386877 100644 --- a/sandboxMP/urls.py +++ b/sandboxMP/urls.py @@ -28,6 +28,7 @@ urlpatterns = [ path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('system/', include('system.urls', namespace='system')), + path('cmdb/', include('cmdb.urls', namespace='cmdb')), ] diff --git a/templates/cmdb/cmdb_index.html b/templates/cmdb/cmdb_index.html new file mode 100644 index 0000000..b83f7f9 --- /dev/null +++ b/templates/cmdb/cmdb_index.html @@ -0,0 +1,20 @@ +{% extends "base-left.html" %} +{% load staticfiles %} + +{% block css %}{% endblock %} +{% block content %} + + +
+ 这里是配置管理首页(临时内容) + +
+ + + +{% endblock %} + + +{% block javascripts %} + +{% endblock %} \ No newline at end of file