blob: 36e5fc6b65f366d634259797cb74dba5eee4ef1e [file] [log] [blame]
Siobhan Tullyce652d02013-10-08 21:52:35 -04001from django.contrib import admin
2
3from requestrouter.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
Scott Baker2290b052014-05-08 10:28:22 -070013from core.admin import SingletonAdmin,SliceInline,ServiceAttrAsTabInline, SliceROInline,ServiceAttrAsTabROInline, ReadOnlyAwareAdmin
Siobhan Tullyce652d02013-10-08 21:52:35 -040014
15class RequestRouterServiceAdmin(SingletonAdmin):
16 model = RequestRouterService
17 verbose_name = "Request Router Service"
18 verbose_name_plural = "Request Router Service"
19 list_display = ("name","enabled")
20 fieldsets = [(None, {'fields': ['name','enabled','versionNumber', 'description','behindNat','defaultTTL','defaultAction','lastResortAction','maxAnswers'], 'classes':['suit-tab suit-tab-general']})]
21 inlines = [SliceInline,ServiceAttrAsTabInline]
22
Scott Bakercd202a02014-05-23 12:47:57 -070023 user_readonly_fields = ["name", "enabled", "versionNumber", "description", "behindNat", "defaultTTL", "defaultAction", "lastResortAction", "maxAnswers"]
Scott Baker2290b052014-05-08 10:28:22 -070024 user_readonly_inlines = [SliceROInline, ServiceAttrAsTabROInline]
Scott Bakercd202a02014-05-23 12:47:57 -070025
Siobhan Tullyce652d02013-10-08 21:52:35 -040026 suit_form_tabs =(('general', 'Request Router Service Details'),
27 ('slices','Slices'),
28 ('serviceattrs','Additional Attributes'),
29 )
30
Scott Baker2290b052014-05-08 10:28:22 -070031class ServiceMapAdmin(ReadOnlyAwareAdmin):
Scott Baker40695e12014-03-13 22:50:45 -070032 model = ServiceMap
33 verbose_name = "Service Map"
34 verbose_name_plural = "Service Map"
35 list_display = ("name", "owner", "slice", "prefix")
Scott Baker2290b052014-05-08 10:28:22 -070036 fieldsets = [(None, {'fields': ['name','owner','slice', 'prefix','siteMap','accessMap'], 'classes':['suit-tab suit-tab-general']})]
Scott Baker40695e12014-03-13 22:50:45 -070037
Scott Bakercd202a02014-05-23 12:47:57 -070038 user_readonly_fields = ["name", "owner", "slice", "prefix", "siteMap", "accessMap"]
39
Scott Baker2290b052014-05-08 10:28:22 -070040 suit_form_tabs =(('general', 'Service Map Details'),
41 )
Siobhan Tullyce652d02013-10-08 21:52:35 -040042
43admin.site.register(RequestRouterService, RequestRouterServiceAdmin)
Scott Baker40695e12014-03-13 22:50:45 -070044admin.site.register(ServiceMap, ServiceMapAdmin)
Siobhan Tullyce652d02013-10-08 21:52:35 -040045