From 7d408f6fca6da1d7fe62783b9851c31c3849916a Mon Sep 17 00:00:00 2001 From: Leonidas Poulopoulos <leopoul@noc.grnet.gr> Date: Tue, 6 Dec 2011 12:28:35 +0200 Subject: [PATCH] Added fields to admin interface. Minor changes with UI datatables --- flowspec/admin.py | 3 ++- flowspec/models.py | 2 ++ templates/user_routes.html | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/flowspec/admin.py b/flowspec/admin.py index f6131d33..7ca2534e 100644 --- a/flowspec/admin.py +++ b/flowspec/admin.py @@ -17,7 +17,8 @@ class RouteAdmin(admin.ModelAdmin): self.message_user(request, "Added request %s to job que. Check in a while for result" % response) deactivate.short_description = "Remove selected routes from network" - list_display = ('name', 'status', 'applier' , 'applier_peer', 'get_match', 'get_then', 'response') + list_display = ('name', 'status', 'applier' , 'applier_peer', 'get_match', 'get_then', 'response', "expires", "comments") + fieldsets = [ (None, {'fields': ['name','applier']}), ("Match", {'fields': ['source', 'sourceport', 'destination', 'destinationport', 'port']}), diff --git a/flowspec/models.py b/flowspec/models.py index b1f5ac5e..9abea820 100644 --- a/flowspec/models.py +++ b/flowspec/models.py @@ -107,6 +107,8 @@ class Route(models.Model): class Meta: db_table = u'route' + verbose_name = "Rule" + verbose_name_plural = "Rules" def save(self, *args, **kwargs): if not self.pk: diff --git a/templates/user_routes.html b/templates/user_routes.html index 73ced250..efd48c9d 100644 --- a/templates/user_routes.html +++ b/templates/user_routes.html @@ -140,7 +140,7 @@ function delete_route(route){ <th>{% trans "Name" %}</th> <th>{% trans "Match" %}</th> <th style="text-align: center;">{% trans "Then" %}</th> - <th style="text-align: center;">{% trans "Status" %}</th> + <th style="text-align: center; ">{% trans "Status" %}</th> {% comment %}<th style="text-align: center;">{% trans "Details" %}</th>{% endcomment %} <th style="text-align: center;">{% trans "Applier" %}</th> <th style="text-align: center;">{% trans "Expires" %}</th> @@ -157,12 +157,12 @@ function delete_route(route){ <td>{{ route.name }}</td> <td>{{ route.get_match|safe|escape }}</td> <td style="text-align: center;">{{route.get_then|safe|escape}}</td> - <td style="text-align: center;">{{route.status}}</td> + <td style="text-align: center; ">{{route.status}}</td> {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %} <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:140px;"> + <td style="text-align: center; width:150px;"> {% 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> -- GitLab