修改url模块, 匹配整体架构风格.

pull/530/head
yumaojun03 2016-12-05 22:54:38 +08:00
parent 61ac9129b0
commit d0460d8691
6 changed files with 5 additions and 64 deletions

View File

@ -1,12 +0,0 @@
from rest_framework.routers import DefaultRouter
from ops.api import views as ops_api_view
api_router = DefaultRouter()
api_router.register(r'host_alia', ops_api_view.HostAliaViewSet)
api_router.register(r'user_alia', ops_api_view.UserAliaViewSet)
api_router.register(r'cmd_alia', ops_api_view.CmdAliaViewSet)
api_router.register(r'runas_alia', ops_api_view.RunasAliaViewSet)
api_router.register(r'extra_conf', ops_api_view.ExtraconfViewSet)
api_router.register(r'privilege', ops_api_view.PrivilegeViewSet)
api_router.register(r'sudo', ops_api_view.SudoViewSet)
api_router.register(r'cron', ops_api_view.CronTableViewSet)

View File

@ -20,7 +20,6 @@ from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import TemplateView
from jumpserver.api_router import api_router
urlpatterns = [
@ -31,20 +30,18 @@ urlpatterns = [
url(r'^perms/', include('perms.urls.views_urls', namespace='perms')),
url(r'^audits/', include('audits.urls.views_urls', namespace='audits')),
url(r'^terminal/', include('terminal.urls.views_urls', namespace='terminal')),
url('^ops/', include('ops.urls.view_urls'), name='ops'),
url(r'^api/users/', include('users.urls.api_urls', namespace='api-users')),
url(r'^api/assets/', include('assets.urls.api_urls', namespace='api-assets')),
url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')),
url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')),
url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')),
url(r'^api/ops/', include('ops.urls.api_urls', namespace='api-ops')),
]
urlpatterns += [
url(r'^api/v1/ops/', include(api_router.urls)),
url(r'^ops/', include('ops.urls', namespace='ops')),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -79,6 +79,7 @@ class Sudo(models.Model):
asset_groups = models.ManyToManyField(AssetGroup, blank=True, related_name='sudos')
extra_lines = models.ManyToManyField(Extra_conf, related_name='sudos', blank=True)
privilege_items = models.ManyToManyField(Privilege, related_name='sudos', blank=True)
created_by = models.CharField(max_length=32, blank=True, verbose_name=_('Created by'))
@property
def all_assets(self):

View File

@ -1,18 +1,9 @@
{% extends '_base_list.html' %}
{% load i18n static %}
{% block table_search %}
<div class="html5buttons">
<div class="dt-buttons btn-group">
<a class="btn btn-default buttons-pdf" tabindex="0" href="#">
<span>PDF</span></a>
<a class="btn btn-default buttons-excel" tabindex="0" href="#">
<span>Excel</span>
</a>
</div>
</div>
{% endblock %}
{% block table_container %}
<div class="uc pull-left m-l-5 m-r-5"><a href="{% url "users:user-create" %}" class="btn btn-sm btn-primary"> {% trans "Create user" %} </a></div>
<div class="uc pull-left m-l-5 m-r-5"><a href="{% url "users:user-create" %}" class="btn btn-sm btn-primary"> {% trans "Create sudo" %} </a></div>
<div class="uc pull-left"><a href="javascript:void(0);" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#user_import_modal"> {% trans "Import user" %} </a></div>
<table class="table table-striped table-bordered table-hover " id="user_list_table" >
<thead>

View File

@ -1,15 +1,6 @@
{% extends '_base_list.html' %}
{% load i18n static %}
{% block table_search %}
<div class="html5buttons">
<div class="dt-buttons btn-group">
<a class="btn btn-default buttons-pdf" tabindex="0" href="#">
<span>PDF</span></a>
<a class="btn btn-default buttons-excel" tabindex="0" href="#">
<span>Excel</span>
</a>
</div>
</div>
{% endblock %}
{% block table_container %}
<div class="uc pull-left m-l-5 m-r-5"><a href="{% url "users:user-create" %}" class="btn btn-sm btn-primary"> {% trans "Create user" %} </a></div>

View File

@ -1,27 +0,0 @@
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
from django.conf.urls import url
import views as page_view
app_name = 'ops'
urlpatterns = [
# Resource Sudo url
url(r'^sudo/list$', page_view.SudoListView.as_view(), name='page-sudo-list'),
url(r'^sudo/create$', page_view.SudoCreateView.as_view(), name='page-sudo-create'),
url(r'^sudo/detail$', page_view.SudoDetailView.as_view(), name='page-sudo-detail'),
url(r'^sudo/update$', page_view.SudoUpdateView.as_view(), name='page-sudo-update'),
# Resource Cron url
url(r'^cron/list$', page_view.CronListView.as_view(), name='page-cron-list'),
url(r'^cron/create$', page_view.CronCreateView.as_view(), name='page-cron-create'),
url(r'^cron/detail$', page_view.CronDetailView.as_view(), name='page-cron-detail'),
url(r'^cron/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'),
]