Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
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"] {
...
@@ -1311,3 +1311,7 @@ textarea[name="new_members"] {
.nowrap {
.nowrap {
white-space: nowrap;
white-space: nowrap;
}
}
.little-margin-bottom {
margin-bottom: 5px;
}
circle/request/models.py
View file @
d09f8aef
...
@@ -47,7 +47,7 @@ class RequestAction(Model):
...
@@ -47,7 +47,7 @@ class RequestAction(Model):
class
RequestType
(
Model
):
class
RequestType
(
Model
):
name
=
CharField
(
max_length
=
25
)
name
=
CharField
(
max_length
=
25
,
verbose_name
=
_
(
"Name"
)
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -128,7 +128,7 @@ class Request(TimeStampedModel):
...
@@ -128,7 +128,7 @@ class Request(TimeStampedModel):
class
LeaseType
(
RequestType
):
class
LeaseType
(
RequestType
):
lease
=
ForeignKey
(
Lease
)
lease
=
ForeignKey
(
Lease
,
verbose_name
=
_
(
"Lease"
)
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
_
(
"
%(name)
s (suspend:
%(s)
s, remove:
%(r)
s)"
)
%
{
return
_
(
"
%(name)
s (suspend:
%(s)
s, remove:
%(r)
s)"
)
%
{
...
@@ -142,7 +142,7 @@ class LeaseType(RequestType):
...
@@ -142,7 +142,7 @@ class LeaseType(RequestType):
class
TemplateAccessType
(
RequestType
):
class
TemplateAccessType
(
RequestType
):
templates
=
ManyToManyField
(
InstanceTemplate
)
templates
=
ManyToManyField
(
InstanceTemplate
,
verbose_name
=
_
(
"Templates"
)
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
"request.views.template-type-detail"
,
return
reverse
(
"request.views.template-type-detail"
,
...
...
circle/request/templates/request/lease-type-form.html
View file @
d09f8aef
...
@@ -14,9 +14,17 @@
...
@@ -14,9 +14,17 @@
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<a
class=
"btn btn-xs btn-default pull-right"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
<div
class=
"pull-right"
>
{% trans "Back" %}
{% if object.pk %}
</a>
<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"
>
<h3
class=
"no-margin"
>
<i
class=
"fa fa-clock-o"
></i>
<i
class=
"fa fa-clock-o"
></i>
{% if form.instance.pk %}
{% if form.instance.pk %}
...
...
circle/request/templates/request/template-type-form.html
View file @
d09f8aef
...
@@ -14,9 +14,17 @@
...
@@ -14,9 +14,17 @@
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<a
class=
"btn btn-xs btn-default pull-right"
href=
"{% url "
request
.
views
.
type-list
"
%}"
>
<div
class=
"pull-right"
>
{% trans "Back" %}
{% if object.pk %}
</a>
<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"
>
<h3
class=
"no-margin"
>
<i
class=
"fa fa-puzzle-piece"
></i>
<i
class=
"fa fa-puzzle-piece"
></i>
{% if form.instance.pk %}
{% if form.instance.pk %}
...
...
circle/request/templates/request/type-list.html
View file @
d09f8aef
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
{% load i18n %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load render_table from django_tables2 %}
{% block title-page %}{% trans "
Group list
" %}{% endblock %}
{% block title-page %}{% trans "
Request types
" %}{% endblock %}
{% block content %}
{% block content %}
...
@@ -24,13 +24,21 @@
...
@@ -24,13 +24,21 @@
<h3
class=
"no-margin"
><i
class=
"fa fa-phone"
></i>
{% trans "Request types" %}
</h3>
<h3
class=
"no-margin"
><i
class=
"fa fa-phone"
></i>
{% trans "Request types" %}
</h3>
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<div
id=
"table_container"
>
<div
class=
"text-muted little-margin-bottom"
>
<div
id=
"rendered_table"
class=
"panel-body"
>
{% trans "Lease types are used for sharing leases. User can request longer ones via these." %}
<div
class=
"table-responsive"
>
</div>
{% render_table lease_table %}
<div
class=
"table-responsive"
>
{% render_table template_table %}
{% render_table lease_table %}
</div>
</div>
</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>
</div>
<!-- .panel-body -->
</div>
<!-- .panel-body -->
</div>
</div>
...
...
circle/request/urls.py
View file @
d09f8aef
...
@@ -23,6 +23,7 @@ from .views import (
...
@@ -23,6 +23,7 @@ from .views import (
LeaseTypeCreate
,
LeaseTypeDetail
,
LeaseTypeCreate
,
LeaseTypeDetail
,
TemplateAccessTypeCreate
,
TemplateAccessTypeDetail
,
TemplateAccessTypeCreate
,
TemplateAccessTypeDetail
,
TemplateRequestView
,
LeaseRequestView
,
ResourceRequestView
,
TemplateRequestView
,
LeaseRequestView
,
ResourceRequestView
,
LeaseTypeDelete
,
TemplateAccessTypeDelete
,
)
)
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
...
@@ -35,17 +36,24 @@ urlpatterns = patterns(
...
@@ -35,17 +36,24 @@ urlpatterns = patterns(
url
(
r'^type/list/$'
,
RequestTypeList
.
as_view
(),
url
(
r'^type/list/$'
,
RequestTypeList
.
as_view
(),
name
=
"request.views.type-list"
),
name
=
"request.views.type-list"
),
# request types
url
(
r'^type/lease/create/$'
,
LeaseTypeCreate
.
as_view
(),
url
(
r'^type/lease/create/$'
,
LeaseTypeCreate
.
as_view
(),
name
=
"request.views.lease-type-create"
),
name
=
"request.views.lease-type-create"
),
url
(
r'^type/lease/(?P<pk>\d+)/$'
,
LeaseTypeDetail
.
as_view
(),
url
(
r'^type/lease/(?P<pk>\d+)/$'
,
LeaseTypeDetail
.
as_view
(),
name
=
"request.views.lease-type-detail"
),
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
(),
url
(
r'^type/template/create/$'
,
TemplateAccessTypeCreate
.
as_view
(),
name
=
"request.views.template-type-create"
),
name
=
"request.views.template-type-create"
),
url
(
r'^type/template/(?P<pk>\d+)/$'
,
url
(
r'^type/template/(?P<pk>\d+)/$'
,
TemplateAccessTypeDetail
.
as_view
(),
TemplateAccessTypeDetail
.
as_view
(),
name
=
"request.views.template-type-detail"
),
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
(),
url
(
r'template/$'
,
TemplateRequestView
.
as_view
(),
name
=
"request.views.request-template"
),
name
=
"request.views.request-template"
),
url
(
r'lease/(?P<vm_pk>\d+)/$'
,
LeaseRequestView
.
as_view
(),
url
(
r'lease/(?P<vm_pk>\d+)/$'
,
LeaseRequestView
.
as_view
(),
...
...
circle/request/views.py
View file @
d09f8aef
...
@@ -17,10 +17,11 @@
...
@@ -17,10 +17,11 @@
from
__future__
import
unicode_literals
,
absolute_import
from
__future__
import
unicode_literals
,
absolute_import
from
django.views.generic
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.shortcuts
import
redirect
,
get_object_or_404
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.urlresolvers
import
reverse
from
braces.views
import
SuperuserRequiredMixin
,
LoginRequiredMixin
from
braces.views
import
SuperuserRequiredMixin
,
LoginRequiredMixin
from
django_tables2
import
SingleTableView
from
django_tables2
import
SingleTableView
...
@@ -109,6 +110,15 @@ class TemplateAccessTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -109,6 +110,15 @@ class TemplateAccessTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin,
form_class
=
TemplateAccessTypeForm
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
):
class
LeaseTypeDetail
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
UpdateView
):
model
=
LeaseType
model
=
LeaseType
template_name
=
"request/lease-type-form.html"
template_name
=
"request/lease-type-form.html"
...
@@ -121,6 +131,14 @@ class LeaseTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin, CreateView):
...
@@ -121,6 +131,14 @@ class LeaseTypeCreate(LoginRequiredMixin, SuperuserRequiredMixin, CreateView):
form_class
=
LeaseTypeForm
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
,
class
RequestTypeList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
TemplateView
):
TemplateView
):
template_name
=
"request/type-list.html"
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