Statistics
| Branch: | Tag: | Revision:

root / flowspec / admin.py @ b27537d5

History | View | Annotate | Download (2.1 kB)

1 a24fbf37 Leonidas Poulopoulos
from django.contrib import admin
2 a24fbf37 Leonidas Poulopoulos
from flowspy.flowspec.models import *
3 6ee21ffd Leonidas Poulopoulos
from flowspy.accounts.models import *
4 357d48dc Leonidas Poulopoulos
from utils import proxy as PR
5 357d48dc Leonidas Poulopoulos
6 97e42c7d Leonidas Poulopoulos
#class RouteAdmin(admin.ModelAdmin):
7 97e42c7d Leonidas Poulopoulos
#    
8 97e42c7d Leonidas Poulopoulos
#    actions = ['deactivate']
9 97e42c7d Leonidas Poulopoulos
#    
10 97e42c7d Leonidas Poulopoulos
#    def deactivate(self, request, queryset):
11 97e42c7d Leonidas Poulopoulos
#        applier = PR.Applier(route_objects=queryset)
12 97e42c7d Leonidas Poulopoulos
#        commit, response = applier.apply(configuration=applier.delete_routes())
13 97e42c7d Leonidas Poulopoulos
#        if commit:
14 97e42c7d Leonidas Poulopoulos
#            rows = queryset.update(is_online=False, is_active=False)
15 97e42c7d Leonidas Poulopoulos
#            queryset.update(response="Successfully removed route from network")
16 97e42c7d Leonidas Poulopoulos
#            self.message_user(request, "Successfully removed %s routes from network" % rows)
17 97e42c7d Leonidas Poulopoulos
#        else:
18 97e42c7d Leonidas Poulopoulos
#            self.message_user(request, "Could not remove routes from network")
19 97e42c7d Leonidas Poulopoulos
#    deactivate.short_description = "Deactivate selected routes from network"
20 97e42c7d Leonidas Poulopoulos
#
21 97e42c7d Leonidas Poulopoulos
#    list_display = ('name', 'is_online', 'applier', 'get_match', 'get_then', 'response')
22 97e42c7d Leonidas Poulopoulos
#    fieldsets = [
23 97e42c7d Leonidas Poulopoulos
#        (None,               {'fields': ['name','applier']}),
24 97e42c7d Leonidas Poulopoulos
#        ("Match",               {'fields': ['source', 'sourceport', 'destination', 'destinationport', 'port']}),
25 97e42c7d Leonidas Poulopoulos
#        ('Advanced Match Statements', {'fields': ['dscp', 'fragmenttype', 'icmpcode', 'icmptype', 'packetlength', 'protocol', 'tcpflag'], 'classes': ['collapse']}),
26 97e42c7d Leonidas Poulopoulos
#        ("Then",               {'fields': ['then' ]}),
27 97e42c7d Leonidas Poulopoulos
#        (None,               {'fields': ['comments',]}),
28 97e42c7d Leonidas Poulopoulos
#        
29 97e42c7d Leonidas Poulopoulos
#    ]
30 b10e01d6 Leonidas Poulopoulos
#    fields = ('name', 'applier', 'expires')
31 357d48dc Leonidas Poulopoulos
32 357d48dc Leonidas Poulopoulos
    #def formfield_for_dbfield(self, db_field, **kwargs):
33 357d48dc Leonidas Poulopoulos
    #    if db_field.name == 'password':
34 357d48dc Leonidas Poulopoulos
    #        kwargs['widget'] = PasswordInput
35 357d48dc Leonidas Poulopoulos
    #    return db_field.formfield(**kwargs)
36 a24fbf37 Leonidas Poulopoulos
37 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchAddress)
38 a24fbf37 Leonidas Poulopoulos
admin.site.register(MatchPort)
39 a24fbf37 Leonidas Poulopoulos
admin.site.register(MatchDscp)
40 6ee21ffd Leonidas Poulopoulos
admin.site.register(UserProfile)
41 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchFragmentType)
42 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchIcmpCode)
43 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchIcmpType)
44 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchPacketLength)
45 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchProtocol)
46 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchTcpFlag)
47 a24fbf37 Leonidas Poulopoulos
admin.site.register(ThenAction)
48 b10e01d6 Leonidas Poulopoulos
#admin.site.register(ThenStatement)
49 b10e01d6 Leonidas Poulopoulos
#admin.site.register(MatchStatement)
50 97e42c7d Leonidas Poulopoulos
admin.site.register(Route)
51 357d48dc Leonidas Poulopoulos
52 357d48dc Leonidas Poulopoulos
admin.site.disable_action('delete_selected')
53 357d48dc Leonidas Poulopoulos