Statistics
| Branch: | Tag: | Revision:

root / flowspec / admin.py @ b27537d5

History | View | Annotate | Download (2.1 kB)

1
from django.contrib import admin
2
from flowspy.flowspec.models import *
3
from flowspy.accounts.models import *
4
from utils import proxy as PR
5

    
6
#class RouteAdmin(admin.ModelAdmin):
7
#    
8
#    actions = ['deactivate']
9
#    
10
#    def deactivate(self, request, queryset):
11
#        applier = PR.Applier(route_objects=queryset)
12
#        commit, response = applier.apply(configuration=applier.delete_routes())
13
#        if commit:
14
#            rows = queryset.update(is_online=False, is_active=False)
15
#            queryset.update(response="Successfully removed route from network")
16
#            self.message_user(request, "Successfully removed %s routes from network" % rows)
17
#        else:
18
#            self.message_user(request, "Could not remove routes from network")
19
#    deactivate.short_description = "Deactivate selected routes from network"
20
#
21
#    list_display = ('name', 'is_online', 'applier', 'get_match', 'get_then', 'response')
22
#    fieldsets = [
23
#        (None,               {'fields': ['name','applier']}),
24
#        ("Match",               {'fields': ['source', 'sourceport', 'destination', 'destinationport', 'port']}),
25
#        ('Advanced Match Statements', {'fields': ['dscp', 'fragmenttype', 'icmpcode', 'icmptype', 'packetlength', 'protocol', 'tcpflag'], 'classes': ['collapse']}),
26
#        ("Then",               {'fields': ['then' ]}),
27
#        (None,               {'fields': ['comments',]}),
28
#        
29
#    ]
30
#    fields = ('name', 'applier', 'expires')
31

    
32
    #def formfield_for_dbfield(self, db_field, **kwargs):
33
    #    if db_field.name == 'password':
34
    #        kwargs['widget'] = PasswordInput
35
    #    return db_field.formfield(**kwargs)
36

    
37
#admin.site.register(MatchAddress)
38
admin.site.register(MatchPort)
39
admin.site.register(MatchDscp)
40
admin.site.register(UserProfile)
41
#admin.site.register(MatchFragmentType)
42
#admin.site.register(MatchIcmpCode)
43
#admin.site.register(MatchIcmpType)
44
#admin.site.register(MatchPacketLength)
45
#admin.site.register(MatchProtocol)
46
#admin.site.register(MatchTcpFlag)
47
admin.site.register(ThenAction)
48
#admin.site.register(ThenStatement)
49
#admin.site.register(MatchStatement)
50
admin.site.register(Route)
51

    
52
admin.site.disable_action('delete_selected')
53

    
54