Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
flowspy
Commits
6b747a1b
Commit
6b747a1b
authored
Dec 07, 2011
by
Leonidas Poulopoulos
Browse files
Fixed an issue in view with expiration date
parent
052c14aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
flowspec/views.py
View file @
6b747a1b
...
...
@@ -26,15 +26,12 @@ from flowspy.flowspec.models import *
from
copy
import
deepcopy
from
flowspy.utils.decorators
import
shib_required
import
datetime
from
django.views.decorators.cache
import
never_cache
from
django.conf
import
settings
from
django.core.mail
import
mail_admins
,
mail_managers
,
send_mail
def
days_offset
():
return
datetime
.
date
.
today
()
+
datetime
.
timedelta
(
days
=
settings
.
EXPIRATION_DAYS_OFFSET
)
@
login_required
def
user_routes
(
request
):
user_routes
=
Route
.
objects
.
filter
(
applier
=
request
.
user
)
...
...
@@ -76,7 +73,6 @@ def add_route(request):
if
form
.
is_valid
():
route
=
form
.
save
(
commit
=
False
)
route
.
applier
=
request
.
user
route
.
expires
=
days_offset
()
route
.
status
=
"PENDING"
route
.
save
()
form
.
save_m2m
()
...
...
@@ -120,7 +116,6 @@ def edit_route(request, route_slug):
route
=
form
.
save
(
commit
=
False
)
route
.
name
=
route_original
.
name
route
.
applier
=
request
.
user
route
.
expires
=
route_original
.
expires
route
.
status
=
"PENDING"
route
.
save
()
form
.
save_m2m
()
...
...
templates/user_routes.html
View file @
6b747a1b
...
...
@@ -145,7 +145,7 @@ function delete_route(route){
<th
style=
"text-align: center;"
>
{% trans "Applier" %}
</th>
<th
style=
"text-align: center;"
>
{% trans "Expires" %}
</th>
<th
style=
"text-align: center;"
>
{% trans "Response" %}
</th>
<th
style=
"text-align: center; width:1
3
0px;"
>
{% trans "Actions" %}
</th>
<th
style=
"text-align: center; width:1
8
0px;"
>
{% trans "Actions" %}
</th>
</tr>
</thead>
...
...
@@ -162,7 +162,7 @@ function delete_route(route){
<td
style=
"text-align: center;"
>
{{ route.applier }}
</td>
<td
style=
"text-align: center;"
>
{{ route.expires }}
</td>
<td
style=
"text-align: center;"
>
{{ route.response }}
</td>
<td
style=
"text-align: center; width:1
5
0px;"
>
<td
style=
"text-align: center; width:1
8
0px;"
>
{% ifequal route.status 'ACTIVE' %}
<a
href=
"{% url edit-route route.name %}"
class=
"edit_button"
id=
"edit_button_{{route.pk}}"
>
Edit
</a>
<button
class=
"del_button"
id=
"{{route.name}}"
onclick=
"javascript:delete_route(this.id)"
>
Del
</button>
...
...
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