mirror of
https://github.com/RobbieHan/sandboxMP.git
synced 2026-04-02 18:18:50 +08:00
create cmdb app
This commit is contained in:
0
apps/cmdb/__init__.py
Normal file
0
apps/cmdb/__init__.py
Normal file
3
apps/cmdb/admin.py
Normal file
3
apps/cmdb/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
apps/cmdb/apps.py
Normal file
5
apps/cmdb/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CmdbConfig(AppConfig):
|
||||
name = 'cmdb'
|
||||
0
apps/cmdb/migrations/__init__.py
Normal file
0
apps/cmdb/migrations/__init__.py
Normal file
22
apps/cmdb/models.py
Normal file
22
apps/cmdb/models.py
Normal 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
3
apps/cmdb/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
9
apps/cmdb/urls.py
Normal file
9
apps/cmdb/urls.py
Normal 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
9
apps/cmdb/views.py
Normal 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'
|
||||
@@ -40,6 +40,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'system',
|
||||
'cmdb',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -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')),
|
||||
|
||||
]
|
||||
|
||||
|
||||
20
templates/cmdb/cmdb_index.html
Normal file
20
templates/cmdb/cmdb_index.html
Normal 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 %}
|
||||
Reference in New Issue
Block a user