Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS699_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
YADNYESH SANTOSH PATIL
CS699_project
Commits
52644d23
Commit
52644d23
authored
Nov 27, 2019
by
ASHISH KUMAR GOYAL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebatereq done
parent
d5d758f3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
2 deletions
+39
-2
hostel_mess/db.sqlite3
hostel_mess/db.sqlite3
+0
-0
hostel_mess/templates/apprebate.html
hostel_mess/templates/apprebate.html
+17
-0
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/utils.py
hostel_mess/usermgmt/utils.py
+16
-0
hostel_mess/usermgmt/views.py
hostel_mess/usermgmt/views.py
+6
-2
No files found.
hostel_mess/db.sqlite3
View file @
52644d23
No preview for this file type
hostel_mess/templates/apprebate.html
View file @
52644d23
...
...
@@ -137,6 +137,7 @@
<h6
class=
"m-0 font-weight-bold text-primary"
><b>
APPROVE REBATES
</b></h6>
</div>
<div
class=
"card-body"
>
{% if pending_rebates %}
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered"
id=
"dataTable"
width=
"100%"
cellspacing=
"0"
>
<thead>
...
...
@@ -160,6 +161,17 @@
</tr>
</tfoot>
<tbody>
{% for rebate in pending_rebates %}
<tr>
<td>
{{ rebate.from }}
</td>
<td>
{{ rebate.to }}
</td>
<td>
{{ rebate.ldap }}
</td>
<td>
{{ rebate.name }}
</td>
<td>
{{ rebate.duration }}
</td>
<td><button
type=
"button"
class=
"btn btn-outline-success"
>
APPROVE
</button>
<button
type=
"button"
class=
"btn btn-outline-danger"
>
REJECT
</button>
</td>
</tr>
{% endfor %}
<tr>
<td>
2011/04/25
</td>
<td>
2011/04/29
</td>
...
...
@@ -172,6 +184,11 @@
</tbody>
</table>
</div>
{% else %}
<div
class=
"text-center"
>
<h5>
No pending Rebate requests currently.
</h5>
</div>
{% endif %}
</div>
</div>
<!--DATA table ends here -->
...
...
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
View file @
52644d23
No preview for this file type
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
View file @
52644d23
No preview for this file type
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
View file @
52644d23
No preview for this file type
hostel_mess/usermgmt/utils.py
View file @
52644d23
from
django.contrib.auth.models
import
User
,
Group
from
django.shortcuts
import
redirect
from
.models
import
Student
,
RebateReq
,
Meal
,
OverheadReq
def
is_manager
(
user
):
return
user
.
groups
.
filter
(
name
=
'manager'
)
.
exists
()
...
...
@@ -10,6 +11,21 @@ def is_worker(user):
def
is_student
(
user
):
return
user
.
groups
.
filter
(
name
=
'student'
)
.
exists
()
def
generate_pending_rebates
():
context
=
{
'pending_rebates'
:[]}
for
reb
in
RebateReq
.
objects
.
filter
(
status
=
'W'
):
context
[
"pending_rebates"
]
.
extend
([{
'from'
:
str
(
reb
.
fromDate
),
'to'
:
str
(
reb
.
toDate
),
'ldap'
:
reb
.
student
.
user
.
username
,
'name'
:
f
'{reb.student.user.first_name+reb.student.user.last_name}'
,
'duration'
:
str
((
reb
.
toDate
-
reb
.
fromDate
)
.
days
)
}])
if
len
(
context
[
"pending_rebates"
])
==
0
:
return
None
else
:
return
context
def
homepage_redirect
(
request
):
user
=
request
.
user
if
is_manager
(
user
):
...
...
hostel_mess/usermgmt/views.py
View file @
52644d23
...
...
@@ -2,7 +2,7 @@ from django.shortcuts import render,redirect
from
django.http
import
HttpResponse
,
HttpRequest
from
django.contrib.auth.models
import
User
from
django.contrib.auth
import
authenticate
,
login
,
logout
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
,
user_passes_test
from
usermgmt.utils
import
*
# Create your views here.
...
...
@@ -46,14 +46,18 @@ def logout_view(request):
return
redirect
(
'base'
)
@
login_required
@
user_passes_test
(
is_student
)
def
student_homepage_view
(
request
):
return
render
(
request
,
'viewreq.html'
,
context
=
None
)
@
login_required
@
user_passes_test
(
is_manager
)
def
manager_homepage_view
(
request
):
return
render
(
request
,
'apprebate.html'
,
context
=
None
)
context
=
generate_pending_rebates
()
return
render
(
request
,
'apprebate.html'
,
context
=
context
)
@
login_required
@
user_passes_test
(
is_worker
)
def
worker_homepage_view
(
request
):
return
render
(
request
,
'appreq.html'
,
context
=
None
)
...
...
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