Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
28cad8b1
authored
Mar 17, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request: add closed by to model
parent
b4bf105c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
7 deletions
+40
-7
circle/request/migrations/0002_auto_20150317_1211.py
+28
-0
circle/request/models.py
+5
-2
circle/request/tables.py
+2
-1
circle/request/templates/request/columns/type.html
+1
-1
circle/request/templates/request/detail.html
+4
-3
No files found.
circle/request/migrations/0002_auto_20150317_1211.py
0 → 100644
View file @
28cad8b1
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
from
django.conf
import
settings
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
(
'request'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'request'
,
name
=
'closed_by'
,
field
=
models
.
ForeignKey
(
related_name
=
'closed_by'
,
to
=
settings
.
AUTH_USER_MODEL
,
null
=
True
),
preserve_default
=
True
,
),
migrations
.
AlterField
(
model_name
=
'request'
,
name
=
'user'
,
field
=
models
.
ForeignKey
(
related_name
=
'user'
,
to
=
settings
.
AUTH_USER_MODEL
),
preserve_default
=
True
,
),
]
circle/request/models.py
View file @
28cad8b1
...
...
@@ -42,7 +42,8 @@ class Request(TimeStampedModel):
)
status
=
CharField
(
choices
=
STATUSES
,
default
=
STATUSES
.
UNSEEN
,
max_length
=
10
)
user
=
ForeignKey
(
User
,
verbose_name
=
_
(
'user'
))
user
=
ForeignKey
(
User
,
related_name
=
"user"
)
closed_by
=
ForeignKey
(
User
,
related_name
=
"closed_by"
,
null
=
True
)
TYPES
=
Choices
(
(
'resource'
,
_
(
'resource request'
)),
(
'lease'
,
_
(
"lease request"
)),
...
...
@@ -90,10 +91,12 @@ class Request(TimeStampedModel):
def
accept
(
self
,
user
):
self
.
action
.
accept
(
user
)
self
.
status
=
"ACCEPTED"
self
.
closed_by
=
user
self
.
save
()
def
decline
(
self
):
def
decline
(
self
,
user
):
self
.
status
=
"DECLINED"
self
.
closed_by
=
user
self
.
save
()
...
...
circle/request/tables.py
View file @
28cad8b1
...
...
@@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from
django_tables2
import
Table
,
A
from
django_tables2.columns
import
(
TemplateColumn
,
LinkColumn
Column
,
TemplateColumn
,
LinkColumn
)
from
request.models
import
Request
,
LeaseType
,
TemplateAccessType
...
...
@@ -45,6 +45,7 @@ class LeaseTypeTable(Table):
args
=
[
A
(
'pk'
)],
verbose_name
=
_
(
"ID"
),
)
lease
=
Column
(
verbose_name
=
_
(
"Lease"
))
class
Meta
:
model
=
LeaseType
...
...
circle/request/templates/request/columns/type.html
View file @
28cad8b1
<i
class=
"fa fa-{{ record.get_request_icon }}"
></i>
{{ record.get_readable_type|
title
}}
{{ record.get_readable_type|
capfirst
}}
circle/request/templates/request/detail.html
View file @
28cad8b1
...
...
@@ -2,6 +2,7 @@
{% load staticfiles %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load arrowfilter %}
{% block title-page %}{% trans "Request" %}{% endblock %}
...
...
@@ -26,7 +27,7 @@
</div>
<p>
<img
src=
"{{ object.user.profile.get_avatar_url }}"
width=
"50"
height=
"50"
/>
<a
href=
"{{ object.user.profile.get_absolute_url }}
"
>
<a
href=
"{{ object.user.profile.get_absolute_url }}"
>
{{ object.user.profile.get_display_name }}
</a>
</p>
...
...
@@ -113,8 +114,8 @@
</div>
{% else %}
<div
class=
"text-right"
>
{% blocktrans with close
_date=object.modified
%}
Closed at {{ close_date }}
{% blocktrans with close
d=object.modified|arrowfilter:LANGUAGE_CODE user=object.closed_by.profile.get_display_name
%}
Closed {{ closed }} by
<a
href=
"{{ user.profile.get_absolute_url }}"
>
{{ user }}
</a>
{% endblocktrans %}
</div>
{% endif %}
...
...
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