create cmdb app

This commit is contained in:
RobbieHan
2018-12-10 20:32:45 +08:00
parent c399b77703
commit ba936d7f9e
11 changed files with 73 additions and 0 deletions

0
apps/cmdb/__init__.py Normal file
View File

3
apps/cmdb/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
apps/cmdb/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class CmdbConfig(AppConfig):
name = 'cmdb'

View File

22
apps/cmdb/models.py Normal file
View File

@@ -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

3
apps/cmdb/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

9
apps/cmdb/urls.py Normal file
View File

@@ -0,0 +1,9 @@
from django.urls import path
from .views import CmdbView
app_name = 'cmdb'
urlpatterns = [
path('', CmdbView.as_view(), name='index'),
]

9
apps/cmdb/views.py Normal file
View File

@@ -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'

View File

@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'system',
'cmdb',
]
MIDDLEWARE = [

View File

@@ -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')),
]

View File

@@ -0,0 +1,20 @@
{% extends "base-left.html" %}
{% load staticfiles %}
{% block css %}{% endblock %}
{% block content %}
<!-- Main content -->
<section class="content">
这里是配置管理首页临时内容
</section>
<!-- /.content -->
{% endblock %}
{% block javascripts %}
{% endblock %}