admin.py 3.93 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017  Gabriel Détraz
# Copyright © 2017  Goulven Kermarec
# Copyright © 2017  Augustin Lemesle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 24 25
"""machines.admin
The objects, fields and datastructures visible in the Django admin view
"""
26

27 28
from __future__ import unicode_literals

29
from django.contrib import admin
30
from reversion.admin import VersionAdmin
31

32
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
Gabriel Detraz's avatar
Gabriel Detraz committed
33 34 35 36 37 38 39 40 41 42 43
from .models import (
    Extension,
    SOA,
    Mx,
    Ns,
    Vlan,
    Txt,
    Srv,
    Nas,
    Service,
    OuverturePort,
Gabriel Detraz's avatar
Gabriel Detraz committed
44
    Ipv6List,
Gabriel Detraz's avatar
Gabriel Detraz committed
45 46
    OuverturePortList
)
47

Gabriel Detraz's avatar
Gabriel Detraz committed
48

49
class MachineAdmin(VersionAdmin):
50
    """ Admin view of a Machine object """
51
    pass
52

Gabriel Detraz's avatar
Gabriel Detraz committed
53

Gabriel Detraz's avatar
Gabriel Detraz committed
54
class Ipv6ListAdmin(VersionAdmin):
55
    """ Admin view of a Ipv6List object """
Gabriel Detraz's avatar
Gabriel Detraz committed
56 57 58
    pass


59
class IpTypeAdmin(VersionAdmin):
60
    """ Admin view of a IpType object """
61
    pass
62

Gabriel Detraz's avatar
Gabriel Detraz committed
63

64
class MachineTypeAdmin(VersionAdmin):
65
    """ Admin view of a MachineType object """
66
    pass
67

Gabriel Detraz's avatar
Gabriel Detraz committed
68

69
class VlanAdmin(VersionAdmin):
70
    """ Admin view of a Vlan object """
71
    pass
72

Gabriel Detraz's avatar
Gabriel Detraz committed
73

74
class ExtensionAdmin(VersionAdmin):
75
    """ Admin view of a Extension object """
76
    pass
77

Gabriel Detraz's avatar
Gabriel Detraz committed
78

79
class SOAAdmin(VersionAdmin):
80
    """ Admin view of a SOA object """
81 82 83
    pass


84
class MxAdmin(VersionAdmin):
85
    """ Admin view of a MX object """
86
    pass
87

Gabriel Detraz's avatar
Gabriel Detraz committed
88

89
class NsAdmin(VersionAdmin):
90
    """ Admin view of a NS object """
91
    pass
92

Gabriel Detraz's avatar
Gabriel Detraz committed
93

Gabriel Detraz's avatar
Gabriel Detraz committed
94
class TxtAdmin(VersionAdmin):
95
    """ Admin view of a TXT object """
Gabriel Detraz's avatar
Gabriel Detraz committed
96 97
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
98

Gabriel Detraz's avatar
Gabriel Detraz committed
99
class SrvAdmin(VersionAdmin):
100
    """ Admin view of a SRV object """
Gabriel Detraz's avatar
Gabriel Detraz committed
101 102 103
    pass


104
class NasAdmin(VersionAdmin):
105
    """ Admin view of a Nas object """
106
    pass
Gabriel Detraz's avatar
Gabriel Detraz committed
107

Gabriel Detraz's avatar
Gabriel Detraz committed
108

109
class IpListAdmin(VersionAdmin):
110
    """ Admin view of a Ipv4List object """
111
    pass
112

Gabriel Detraz's avatar
Gabriel Detraz committed
113

114
class OuverturePortAdmin(VersionAdmin):
115
    """ Admin view of a OuverturePort object """
116 117
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
118

119
class OuverturePortListAdmin(VersionAdmin):
120
    """ Admin view of a OuverturePortList object """
121 122
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
123

124
class InterfaceAdmin(VersionAdmin):
125
    """ Admin view of a Interface object """
126
    list_display = ('machine', 'type', 'mac_address', 'ipv4', 'details')
127

Gabriel Detraz's avatar
Gabriel Detraz committed
128

chirac's avatar
chirac committed
129
class DomainAdmin(VersionAdmin):
130
    """ Admin view of a Domain object """
chirac's avatar
chirac committed
131
    list_display = ('interface_parent', 'name', 'extension', 'cname')
132

Gabriel Detraz's avatar
Gabriel Detraz committed
133

134
class ServiceAdmin(VersionAdmin):
135
    """ Admin view of a ServiceAdmin object """
136
    list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
137

Gabriel Detraz's avatar
Gabriel Detraz committed
138

139 140
admin.site.register(Machine, MachineAdmin)
admin.site.register(MachineType, MachineTypeAdmin)
141
admin.site.register(IpType, IpTypeAdmin)
142
admin.site.register(Extension, ExtensionAdmin)
143
admin.site.register(SOA, SOAAdmin)
144 145
admin.site.register(Mx, MxAdmin)
admin.site.register(Ns, NsAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
146
admin.site.register(Txt, TxtAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
147
admin.site.register(Srv, SrvAdmin)
148 149
admin.site.register(IpList, IpListAdmin)
admin.site.register(Interface, InterfaceAdmin)
chirac's avatar
chirac committed
150
admin.site.register(Domain, DomainAdmin)
151
admin.site.register(Service, ServiceAdmin)
152
admin.site.register(Vlan, VlanAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
153
admin.site.register(Ipv6List, Ipv6ListAdmin)
154
admin.site.register(Nas, NasAdmin)
155 156
admin.site.register(OuverturePort, OuverturePortAdmin)
admin.site.register(OuverturePortList, OuverturePortListAdmin)