blob: 65a646b966c97ab38d465902c560659606a437ad [file] [log] [blame]
Scott Bakerc97b56d2014-11-06 17:38:38 -08001from django.contrib import admin
2
3from servcomp.models import *
4from django import forms
5from django.utils.safestring import mark_safe
6from django.contrib.auth.admin import UserAdmin
7from django.contrib.admin.widgets import FilteredSelectMultiple
8from django.contrib.auth.forms import ReadOnlyPasswordHashField
9from django.contrib.auth.signals import user_logged_in
10from django.utils import timezone
11from django.contrib.contenttypes import generic
12from suit.widgets import LinkedSelect
13from core.admin import SingletonAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, PlStackTabularInline
14
15class CompositionServiceAdmin(SingletonAdmin):
16 model = CompositionService
17 verbose_name = "Composition Service"
18 verbose_name_plural = "Composition Service"
19 list_display = ("backend_status_icon", "name","enabled")
20 list_display_links = ('backend_status_icon', 'name', )
21 fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description'], 'classes':['suit-tab suit-tab-general']})]
22 readonly_fields = ('backend_status_text', )
23 inlines = [SliceInline,ServiceAttrAsTabInline]
24
25 user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
26
27 suit_form_tabs =(('general', 'Composition Service Details'),
28 ('slices','Slices'),
29 ('serviceattrs','Additional Attributes'),
30 )
31
32class CompositionAdmin(ReadOnlyAwareAdmin):
33 list_display = ('backend_status_icon', 'name' )
34 list_display_links = ('backend_status_icon', 'name' )
35
36 fields = ('backend_status_text', 'name')
37 readonly_fields = ('backend_status_text', )
38 user_readonly_fields = ('name',)
39
40class EndUserAdmin(ReadOnlyAwareAdmin):
41 list_display = ('backend_status_icon', 'email', 'macAddress', 'composition' )
42 list_display_links = ('backend_status_icon', 'email' )
43
44 fields = ('backend_status_text', 'email', 'firstName', 'lastName', 'macAddress', 'composition')
45 readonly_fields = ('backend_status_text', )
46 user_readonly_fields = ('email', 'firstName', 'lastName', 'macAddress')
47
48admin.site.register(CompositionService, CompositionServiceAdmin)
49admin.site.register(Composition, CompositionAdmin)
50admin.site.register(EndUser, EndUserAdmin)
51