admin.py 3.93 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
lhark's avatar
lhark committed
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.
Maël Kervella's avatar
Maël Kervella committed
23 24 25
"""machines.admin
The objects, fields and datastructures visible in the Django admin view
"""
lhark's avatar
lhark committed
26

27 28
from __future__ import unicode_literals

Dalahro's avatar
Dalahro committed
29
from django.contrib import admin
30
from reversion.admin import VersionAdmin
Dalahro's avatar
Dalahro committed
31

32
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
Gabriel Detraz's avatar
Fix #52  
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
Fix #52  
Gabriel Detraz committed
45 46
    OuverturePortList
)
Dalahro's avatar
Dalahro committed
47

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
48

49
class MachineAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
50
    """ Admin view of a Machine object """
51
    pass
Dalahro's avatar
Dalahro committed
52

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
53

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


chirac's avatar
chirac committed
59
class IpTypeAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
60
    """ Admin view of a IpType object """
61
    pass
62

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
63

chirac's avatar
chirac committed
64
class MachineTypeAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
65
    """ Admin view of a MachineType object """
66
    pass
chirac's avatar
chirac committed
67

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
68

69
class VlanAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
70
    """ Admin view of a Vlan object """
71
    pass
chirac's avatar
chirac committed
72

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
73

74
class ExtensionAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
75
    """ Admin view of a Extension object """
76
    pass
Dalahro's avatar
Dalahro committed
77

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
78

79
class SOAAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
80
    """ Admin view of a SOA object """
81 82 83
    pass


84
class MxAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
85
    """ Admin view of a MX object """
86
    pass
87

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
88

89
class NsAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
90
    """ Admin view of a NS object """
91
    pass
92

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
93

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

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
98

Gabriel Detraz's avatar
Fix #52  
Gabriel Detraz committed
99
class SrvAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
100
    """ Admin view of a SRV object """
Gabriel Detraz's avatar
Fix #52  
Gabriel Detraz committed
101 102 103
    pass


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

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
108

109
class IpListAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
110
    """ Admin view of a Ipv4List object """
111
    pass
chirac's avatar
chirac committed
112

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
113

114
class OuverturePortAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
115
    """ Admin view of a OuverturePort object """
116 117
    pass

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
118

119
class OuverturePortListAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
120
    """ Admin view of a OuverturePortList object """
121 122
    pass

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
123

124
class InterfaceAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
125
    """ Admin view of a Interface object """
Maël Kervella's avatar
Maël Kervella committed
126
    list_display = ('machine', 'type', 'mac_address', 'ipv4', 'details')
chirac's avatar
chirac committed
127

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
128

chirac's avatar
chirac committed
129
class DomainAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
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
Doc  
Gabriel Detraz committed
133

134
class ServiceAdmin(VersionAdmin):
Maël Kervella's avatar
Maël Kervella committed
135
    """ Admin view of a ServiceAdmin object """
136
    list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
137

Gabriel Detraz's avatar
Doc  
Gabriel Detraz committed
138

Dalahro's avatar
Dalahro committed
139 140
admin.site.register(Machine, MachineAdmin)
admin.site.register(MachineType, MachineTypeAdmin)
chirac's avatar
chirac committed
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
Fix #52  
Gabriel Detraz committed
147
admin.site.register(Srv, SrvAdmin)
chirac's avatar
chirac committed
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)