Add asset group view and url

pull/530/head
ibuler 8 years ago
parent d96ac56460
commit 11d06b5e2b

@ -1,20 +1,23 @@
# coding:utf-8
from django.conf.urls import url,include
from .views import *
from .api import (
AssetGroupViewSet,AssetViewSet,IDCViewSet
)
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'assetgroup', AssetGroupViewSet)
router.register(r'asset', AssetViewSet)
router.register(r'idc', IDCViewSet)
import views
# from rest_framework import routers
# router = routers.DefaultRouter()
# router.register(r'assetgroup', AssetGroupViewSet)
# router.register(r'asset', AssetViewSet)
# router.register(r'idc', IDCViewSet)
app_name = 'assets'
urlpatterns = [
url(r'^add/$', AssetAddView.as_view(), name='asset-add'),
url(r'^$', AssetListView.as_view(), name='asset-list'),
url(r'^(?P<pk>[0-9]+)/delete/$', AssetDeleteView.as_view(), name='asset-list'),
url(r'^(?P<pk>[0-9]+)/detail/$', AssetDetailView.as_view(), name='asset-detail'),
url(r'^api/v1.0/', include(router.urls)),
url(r'^asset', views.AssetListView.as_view(), name='asset-list'),
url(r'^asset/add$', views.AssetAddView.as_view(), name='asset-add'),
url(r'^asset/(?P<pk>[0-9]+)$', views.AssetDetailView.as_view(), name='asset-detail'),
url(r'^asset/(?P<pk>[0-9]+)$/edit', views.AssetEditView.as_view(), name='asset-edit'),
url(r'^asset/(?P<pk>[0-9]+)/delete$', views.AssetDeleteView.as_view(), name='asset-delete'),
url(r'^asset-group', views.AssetGroupListView.as_view(), name='assetgroup-list'),
url(r'^asset-group/add$', views.AssetAddView.as_view(), name='asset-add'),
url(r'^asset-group/(?P<pk>[0-9]+)$', views.AssetDetailView.as_view(), name='asset-detail'),
url(r'^asset-group/(?P<pk>[0-9]+)$/edit', views.AssetEditView.as_view(), name='asset-edit'),
url(r'^asset-group/(?P<pk>[0-9]+)/delete$', views.AssetDeleteView.as_view(), name='asset-delete'),
# url(r'^api/v1.0/', include(router.urls)),
]

@ -1,28 +1,11 @@
from django.views.generic import (
TemplateView, ListView
)
from __future__ import absolute_import, unicode_literals
from django.views.generic import TemplateView, ListView
from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView
from django.urls import reverse_lazy
from django.views.generic.edit import (
CreateView, DeleteView, FormView, UpdateView
)
from django.views.generic.detail import (
DetailView
)
from .models import (
Asset, AssetGroup, IDC, AssetExtend
)
from .forms import (
AssetForm,
)
from django.views.generic.detail import DetailView
from .models import Asset, AssetGroup, IDC, AssetExtend
from .forms import AssetForm
class AssetAddView(CreateView):
@ -32,7 +15,7 @@ class AssetAddView(CreateView):
success_url = reverse_lazy('assets:asset-list')
class AssetEdit():
class AssetEditView(UpdateView):
pass
@ -52,3 +35,22 @@ class AssetDetailView(DetailView):
context_object_name = 'asset'
template_name = 'assets/asset_detail.html'
class AssetGroupAddView(CreateView):
pass
class AssetGroupListView(ListView):
pass
class AssetGroupDetailView(DetailView):
pass
class AssetGroupEditView(UpdateView):
pass
class AssetGroupDeleteView(DeleteView):
pass

Loading…
Cancel
Save