Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 1 | from django.contrib import admin |
| 2 | |
| 3 | from requestrouter.models import * |
| 4 | from django import forms |
| 5 | from django.utils.safestring import mark_safe |
| 6 | from django.contrib.auth.admin import UserAdmin |
| 7 | from django.contrib.admin.widgets import FilteredSelectMultiple |
| 8 | from django.contrib.auth.forms import ReadOnlyPasswordHashField |
| 9 | from django.contrib.auth.signals import user_logged_in |
| 10 | from django.utils import timezone |
| 11 | from django.contrib.contenttypes import generic |
| 12 | from suit.widgets import LinkedSelect |
Scott Baker | 2290b05 | 2014-05-08 10:28:22 -0700 | [diff] [blame] | 13 | from core.admin import SingletonAdmin,SliceInline,ServiceAttrAsTabInline, SliceROInline,ServiceAttrAsTabROInline, ReadOnlyAwareAdmin |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 14 | |
| 15 | class 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 Baker | cd202a0 | 2014-05-23 12:47:57 -0700 | [diff] [blame] | 23 | user_readonly_fields = ["name", "enabled", "versionNumber", "description", "behindNat", "defaultTTL", "defaultAction", "lastResortAction", "maxAnswers"] |
Scott Baker | 2290b05 | 2014-05-08 10:28:22 -0700 | [diff] [blame] | 24 | user_readonly_inlines = [SliceROInline, ServiceAttrAsTabROInline] |
Scott Baker | cd202a0 | 2014-05-23 12:47:57 -0700 | [diff] [blame] | 25 | |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 26 | suit_form_tabs =(('general', 'Request Router Service Details'), |
| 27 | ('slices','Slices'), |
| 28 | ('serviceattrs','Additional Attributes'), |
| 29 | ) |
| 30 | |
Scott Baker | 2290b05 | 2014-05-08 10:28:22 -0700 | [diff] [blame] | 31 | class ServiceMapAdmin(ReadOnlyAwareAdmin): |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 32 | model = ServiceMap |
| 33 | verbose_name = "Service Map" |
| 34 | verbose_name_plural = "Service Map" |
| 35 | list_display = ("name", "owner", "slice", "prefix") |
Scott Baker | 2290b05 | 2014-05-08 10:28:22 -0700 | [diff] [blame] | 36 | fieldsets = [(None, {'fields': ['name','owner','slice', 'prefix','siteMap','accessMap'], 'classes':['suit-tab suit-tab-general']})] |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 37 | |
Scott Baker | cd202a0 | 2014-05-23 12:47:57 -0700 | [diff] [blame] | 38 | user_readonly_fields = ["name", "owner", "slice", "prefix", "siteMap", "accessMap"] |
| 39 | |
Scott Baker | 2290b05 | 2014-05-08 10:28:22 -0700 | [diff] [blame] | 40 | suit_form_tabs =(('general', 'Service Map Details'), |
| 41 | ) |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 42 | |
| 43 | admin.site.register(RequestRouterService, RequestRouterServiceAdmin) |
Scott Baker | 40695e1 | 2014-03-13 22:50:45 -0700 | [diff] [blame] | 44 | admin.site.register(ServiceMap, ServiceMapAdmin) |
Siobhan Tully | ce652d0 | 2013-10-08 21:52:35 -0400 | [diff] [blame] | 45 | |