Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d09f8aef
authored
Mar 25, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request: delete view for request types
parent
f08a4701
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
18 deletions
+72
-18
circle/dashboard/static/dashboard/dashboard.less
+4
-0
circle/request/models.py
+3
-3
circle/request/templates/request/lease-type-form.html
+11
-3
circle/request/templates/request/template-type-form.html
+11
-3
circle/request/templates/request/type-list.html
+16
-8
circle/request/urls.py
+8
-0
circle/request/views.py
+19
-1
No files found.
circle/dashboard/static/dashboard/dashboard.less
View file @
d09f8aef
...
...
@@ -1311,3 +1311,7 @@ textarea[name="new_members"] {
.nowrap {
white-space: nowrap;
}
.little-margin-bottom {
margin-bottom: 5px;
}
circle/request/models.py
View file @
d09f8aef
...
...
@@ -47,7 +47,7 @@ class RequestAction(Model):
class
RequestType
(
Model
):
name
=
CharField
(
max_length
=
25
)
name
=
CharField
(
max_length
=
25
,
verbose_name
=
_
(
"Name"
)
)
def
__unicode__
(
self
):
return
self
.
name
...
...
@@ -128,7 +128,7 @@ class Request(TimeStampedModel):
class
LeaseType
(
RequestType
):
lease
=
ForeignKey
(
Lease
)
lease
=
ForeignKey
(
Lease
,
verbose_name
=
_
(
"Lease"
)
)
def
__unicode__
(
self
):
return
_
(
"
%(name)
s (suspend:
%(s)
s, remove:
%(r)
s)"
)
%
{
...
...
@@ -142,7 +142,7 @@ class LeaseType(RequestType):
class
TemplateAccessType
(
RequestType
):
templates
=
ManyToManyField
(
InstanceTemplate
)
templates
=
ManyToManyField
(
InstanceTemplate
,
verbose_name
=
_
(
"Templates"
)
)
def
get_absolute_url
(
self
):
return
reverse
(
"request.views.template-type-detail"
,
...
...
circle/request/templates/request/lease-type-form.html
View file @
d09f8aef
...
...
@@ -14,9 +14,17 @@
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<a
class=
"btn btn-xs btn-default pull-right"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
{% trans "Back" %}
</a>
<div
class=
"pull-right"
>
{% if object.pk %}
<a
class=
"btn btn-xs btn-danger"
href=
"{% url "
request
.
views
.
lease-type-delete
"
pk=
object.pk
%}"
>
<i
class=
"fa fa-times"
></i>
{% trans "Delete" %}
</a>
{% endif %}
<a
class=
"btn btn-xs btn-default"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
{% trans "Back" %}
</a>
</div>
<h3
class=
"no-margin"
>
<i
class=
"fa fa-clock-o"
></i>
{% if form.instance.pk %}
...
...
circle/request/templates/request/template-type-form.html
View file @
d09f8aef
...
...
@@ -14,9 +14,17 @@
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<a
class=
"btn btn-xs btn-default pull-right"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
{% trans "Back" %}
</a>
<div
class=
"pull-right"
>
{% if object.pk %}
<a
class=
"btn btn-xs btn-danger"
href=
"{% url "
request
.
views
.
template-type-delete
"
pk=
object.pk
%}"
>
<i
class=
"fa fa-times"
></i>
{% trans "Delete" %}
</a>
{% endif %}
<a
class=
"btn btn-xs btn-default"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
{% trans "Back" %}
</a>
</div>
<h3
class=
"no-margin"
>
<i
class=
"fa fa-puzzle-piece"
></i>
{% if form.instance.pk %}
...
...
circle/request/templates/request/type-list.html
View file @
d09f8aef
...
...
@@ -3,7 +3,7 @@
{% load i18n %}
{% load render_table from django_tables2 %}
{% block title-page %}{% trans "
Group list
" %}{% endblock %}
{% block title-page %}{% trans "
Request types
" %}{% endblock %}
{% block content %}
...
...
@@ -24,13 +24,21 @@
<h3
class=
"no-margin"
><i
class=
"fa fa-phone"
></i>
{% trans "Request types" %}
</h3>
</div>
<div
class=
"panel-body"
>
<div
id=
"table_container"
>
<div
id=
"rendered_table"
class=
"panel-body"
>
<div
class=
"table-responsive"
>
{% render_table lease_table %}
{% render_table template_table %}
</div>
</div>
<div
class=
"text-muted little-margin-bottom"
>
{% trans "Lease types are used for sharing leases. User can request longer ones via these." %}
</div>
<div
class=
"table-responsive"
>
{% render_table lease_table %}
</div>
<div
class=
"text-muted little-margin-bottom"
>
{% blocktrans %}
Template access types are used for sharing multiple templates with users.
They can request these with user or operator level access on the included templates.
{% endblocktrans %}
</div>
<div
class=
"table-responsive"
>
{% render_table template_table %}
</div>
</div>
<!-- .panel-body -->
</div>
...
...
circle/request/urls.py
View file @
d09f8aef
...
...
@@ -23,6 +23,7 @@ from .views import (
LeaseTypeCreate
,
LeaseTypeDetail
,
TemplateAccessTypeCreate
,
TemplateAccessTypeDetail
,
TemplateRequestView
,
LeaseRequestView
,
ResourceRequestView
,
LeaseTypeDelete
,
TemplateAccessTypeDelete
,
)
urlpatterns
=
patterns
(
...
...
@@ -35,17 +36,24 @@ urlpatterns = patterns(
url
(
r'^type/list/$'
,
RequestTypeList
.
as_view
(),
name
=
"request.views.type-list"
),
# request types
url
(
r'^type/lease/create/$'
,
LeaseTypeCreate
.
as_view
(),
name
=
"request.views.lease-type-create"
),
url
(
r'^type/lease/(?P<pk>\d+)/$'
,
LeaseTypeDetail
.
as_view
(),
name
=
"request.views.lease-type-detail"
),
url
(
r'^type/lease/delete/(?P<pk>\d+)/$'
,
LeaseTypeDelete
.
as_view
(),
name
=
"request.views.lease-type-delete"
),
url
(
r'^type/template/create/$'
,
TemplateAccessTypeCreate
.
as_view
(),
name
=
"request.views.template-type-create"
),
url
(
r'^type/template/(?P<pk>\d+)/$'
,
TemplateAccessTypeDetail
.
as_view
(),
name
=
"request.views.template-type-detail"
),
url
(
r'^type/template/delete/(?P<pk>\d+)/$'
,
TemplateAccessTypeDelete
.
as_view
(),
name
=
"request.views.template-type-delete"
),
# request views (visible for users)
url
(
r'template/$'
,
TemplateRequestView
.
as_view
(),
name
=
"request.views.request-template"
),
url
(
r'lease/(?P<vm_pk>\d+)/$'
,
LeaseRequestView
.
as_view
(),
...
...
circle/request/views.py
View file @
d09f8aef
...
...
@@ -17,10 +17,11 @@
from
__future__
import
unicode_literals
,
absolute_import
from
django.views.generic
import
(
UpdateView
,
TemplateView
,
DetailView
,
CreateView
,
FormView
,
UpdateView
,
TemplateView
,
DetailView
,
CreateView
,
FormView
,
DeleteView
,
)
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.urlresolvers
import
reverse
from
braces.views
import
SuperuserRequiredMixin
,
LoginRequiredMixin
from
django_tables2
import
SingleTableView
...
...
@@ -109,6 +110,15 @@ class TemplateAccessTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin,
form_class
=
TemplateAccessTypeForm
class
TemplateAccessTypeDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
model
=
TemplateAccessType
template_name
=
"dashboard/confirm/base-delete.html"
def
get_success_url
(
self
):
return
reverse
(
"request.views.type-list"
)
class
LeaseTypeDetail
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
UpdateView
):
model
=
LeaseType
template_name
=
"request/lease-type-form.html"
...
...
@@ -121,6 +131,14 @@ class LeaseTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin, CreateView):
form_class
=
LeaseTypeForm
class
LeaseTypeDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
model
=
LeaseType
template_name
=
"dashboard/confirm/base-delete.html"
def
get_success_url
(
self
):
return
reverse
(
"request.views.type-list"
)
class
RequestTypeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
TemplateView
):
template_name
=
"request/type-list.html"
...
...
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