-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.py
63 lines (41 loc) · 1.82 KB
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
__author__ = 'Christophe Bastin'
from django.contrib import admin
from models import *
class CnxServerProcessorInline(admin.TabularInline):
model = CnxServerProcessor
extra = 1
class CnxServerGraphicCardInline(admin.TabularInline):
model = CnxServerGraphicCard
extra = 1
class CnxServerHardDriveInline(admin.TabularInline):
model = CnxServerHardDrive
extra = 1
class ProcessorAdmin(admin.ModelAdmin):
pass
class GraphicCardAdmin(admin.ModelAdmin):
pass
class HardDriveAdmin(admin.ModelAdmin):
pass
class ComputerAdmin(admin.ModelAdmin):
list_display = ('ref_user', 'name')
class DesktopAdmin(admin.ModelAdmin):
list_display = ('ref_user', 'name', 'ref_processor', 'memory_size', 'ref_graphic_card', 'ref_hard_drive',
'ref_localisation', 'serial')
fields = ('serial', 'name', 'ref_user', 'ref_processor', 'memory_size', 'ref_graphic_card', 'ref_hard_drive',
'ref_localisation', 'usage_note')
class LaptopAdmin(admin.ModelAdmin):
list_display = ('ref_user', 'name', 'ref_processor', 'memory_size', 'ref_graphic_card', 'ref_hard_drive',
'ref_localisation', 'serial')
fields = ('serial', 'name', 'ref_user', 'ref_processor', 'memory_size', 'ref_graphic_card', 'ref_hard_drive',
'ref_localisation', 'usage_note')
class ServerAdmin(admin.ModelAdmin):
list_display = ('name', 'serial', 'ref_localisation')
inlines = (CnxServerProcessorInline, CnxServerGraphicCardInline, CnxServerHardDriveInline,)
admin.site.register(Processor, ProcessorAdmin)
admin.site.register(GraphicCard)
admin.site.register(HardDrive)
admin.site.register(Localisation)
#admin.site.register(Computer, ComputerAdmin)
admin.site.register(Desktop, DesktopAdmin)
admin.site.register(Laptop, LaptopAdmin)
admin.site.register(Server, ServerAdmin)