admin.py 2.4 KB
Newer Older
lhark's avatar
lhark committed
1 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.

Dalahro's avatar
Dalahro committed
23
from django.contrib import admin
24
from reversion.admin import VersionAdmin
Dalahro's avatar
Dalahro committed
25

26
from .models import IpType, Machine, MachineType, Domain, IpList, Interface, Extension, Mx, Ns, Service
Dalahro's avatar
Dalahro committed
27

28
class MachineAdmin(VersionAdmin):
chirac's avatar
chirac committed
29
    list_display = ('user','name','active')
Dalahro's avatar
Dalahro committed
30

chirac's avatar
chirac committed
31
class IpTypeAdmin(VersionAdmin):
guimoz's avatar
guimoz committed
32
    list_display = ('type','extension','need_infra','domaine_ip','domaine_range')
33

chirac's avatar
chirac committed
34 35 36 37
class MachineTypeAdmin(VersionAdmin):
    list_display = ('type','ip_type')


38
class ExtensionAdmin(VersionAdmin):
39
    list_display = ('name','origin')
Dalahro's avatar
Dalahro committed
40

41 42 43 44
class MxAdmin(VersionAdmin):
    list_display = ('zone', 'priority', 'name')

class NsAdmin(VersionAdmin):
Gabriel Detraz's avatar
Gabriel Detraz committed
45
    list_display = ('zone', 'ns')
46

47
class IpListAdmin(VersionAdmin):
48
    list_display = ('ipv4','ip_type')
chirac's avatar
chirac committed
49

50
class InterfaceAdmin(VersionAdmin):
chirac's avatar
chirac committed
51
    list_display = ('machine','type','mac_address','ipv4','details')
chirac's avatar
chirac committed
52

chirac's avatar
chirac committed
53 54
class DomainAdmin(VersionAdmin):
    list_display = ('interface_parent', 'name', 'extension', 'cname')
55

56 57 58
class ServiceAdmin(VersionAdmin):
    list_display = ('service_type', 'time_regen')

Dalahro's avatar
Dalahro committed
59 60
admin.site.register(Machine, MachineAdmin)
admin.site.register(MachineType, MachineTypeAdmin)
chirac's avatar
chirac committed
61
admin.site.register(IpType, IpTypeAdmin)
62
admin.site.register(Extension, ExtensionAdmin)
63 64
admin.site.register(Mx, MxAdmin)
admin.site.register(Ns, NsAdmin)
chirac's avatar
chirac committed
65 66
admin.site.register(IpList, IpListAdmin)
admin.site.register(Interface, InterfaceAdmin)
chirac's avatar
chirac committed
67
admin.site.register(Domain, DomainAdmin)
68
admin.site.register(Service, ServiceAdmin)