Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
efab5d92
authored
Nov 12, 2018
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request: Add RequestField views
Added views to list, edit, delete RequestField model objects.
parent
294fcb2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletions
+42
-1
circle/request/urls.py
+9
-0
circle/request/views.py
+33
-1
No files found.
circle/request/urls.py
View file @
efab5d92
...
...
@@ -24,6 +24,8 @@ from .views import (
TemplateAccessTypeCreate
,
TemplateAccessTypeDetail
,
TemplateRequestView
,
LeaseRequestView
,
ResourceRequestView
,
LeaseTypeDelete
,
TemplateAccessTypeDelete
,
ResizeRequestView
,
RequestFieldFormView
,
RequestFieldListView
,
RequestFieldDetailView
,
RequestFieldDeleteView
,
)
urlpatterns
=
[
...
...
@@ -35,6 +37,13 @@ urlpatterns = [
url
(
r'^type/list/$'
,
RequestTypeList
.
as_view
(),
name
=
"request.views.type-list"
),
url
(
r'fields/add/$'
,
RequestFieldFormView
.
as_view
(),
name
=
'field_add'
),
url
(
r'fields/$'
,
RequestFieldListView
.
as_view
(),
name
=
'fields_list'
),
url
(
r'fields/field/(?P<pk>[0-9]+)/$'
,
RequestFieldDetailView
.
as_view
(),
name
=
'fields_detail'
),
url
(
r'^delete/(?P<pk>\d+)/$'
,
RequestFieldDeleteView
.
as_view
(),
name
=
'field_delete'
),
# request types
url
(
r'^type/lease/create/$'
,
LeaseTypeCreate
.
as_view
(),
name
=
"request.views.lease-type-create"
),
...
...
circle/request/views.py
View file @
efab5d92
...
...
@@ -18,6 +18,7 @@ from __future__ import unicode_literals, absolute_import
from
django.views.generic
import
(
UpdateView
,
TemplateView
,
DetailView
,
CreateView
,
FormView
,
DeleteView
,
ListView
)
from
django.contrib
import
messages
from
django.contrib.messages.views
import
SuccessMessageMixin
...
...
@@ -32,7 +33,7 @@ from django_tables2 import SingleTableView
from
request.models
import
(
Request
,
TemplateAccessType
,
LeaseType
,
TemplateAccessAction
,
ExtendLeaseAction
,
ResourceChangeAction
,
DiskResizeAction
ExtendLeaseAction
,
ResourceChangeAction
,
DiskResizeAction
,
RequestField
)
from
storage.models
import
Disk
from
vm.models
import
Instance
...
...
@@ -42,7 +43,38 @@ from request.tables import (
from
request.forms
import
(
LeaseTypeForm
,
TemplateAccessTypeForm
,
TemplateRequestForm
,
LeaseRequestForm
,
ResourceRequestForm
,
ResizeRequestForm
,
RequestFieldModelForm
)
from
django.urls
import
reverse_lazy
class
RequestFieldFormView
(
LoginRequiredMixin
,
CreateView
):
template_name
=
'request/field_form.html'
model
=
RequestField
form_class
=
RequestFieldModelForm
success_url
=
reverse_lazy
(
'fields_list'
)
class
RequestFieldListView
(
LoginRequiredMixin
,
ListView
):
template_name
=
'request/field_list.html'
model
=
RequestField
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
ctx
=
super
(
RequestFieldListView
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
ctx
[
'add_form'
]
=
RequestFieldModelForm
()
ctx
[
'requests'
]
=
Request
.
objects
.
all
()
return
ctx
class
RequestFieldDetailView
(
LoginRequiredMixin
,
DetailView
):
model
=
RequestField
class
RequestFieldDeleteView
(
LoginRequiredMixin
,
DeleteView
):
model
=
RequestField
success_url
=
reverse_lazy
(
'fields_list'
)
class
RequestList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment