Commit 6b747a1b authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Fixed an issue in view with expiration date

parent 052c14aa
......@@ -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()
......
......@@ -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:130px;">{% trans "Actions" %}</th>
<th style="text-align: center; width:180px;">{% 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:150px;">
<td style="text-align: center; width:180px;">
{% 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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment