blob: efd9eb36f06d77e9a0b8995e756c3eb7e0a9479b [file] [log] [blame]
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04001from django.contrib import admin
2
3from hpc.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
13
14#class HPCRRBaseAdmin(admin.ModelAdmin):
15 #exclude = ['enacted']
16
17class CDNPrefixInline(admin.TabularInline):
18 model = CDNPrefix
19 extra = 0
20 suit_classes = 'suit-tab suit-tab-prefixes'
21
22class ContentProviderInline(admin.TabularInline):
23 model = ContentProvider
24 extra = 0
25 suit_classes = 'suit-tab suit-tab-cps'
26
27class OriginServerAdmin(admin.ModelAdmin):
28 list_display = ('url','protocol','redirects','contentProvider','authenticated','enabled' )
29
30class ContentProviderForm(forms.ModelForm):
31 class Meta:
32 widgets = {
33 'serviceProvider' : LinkedSelect
34 }
35
36class ContentProviderAdmin(admin.ModelAdmin):
37 form = ContentProviderForm
38 list_display = ('name','description','enabled' )
39 fieldsets = [ (None, {'fields': ['name','enabled','description','serviceProvider','users'], 'classes':['suit-tab suit-tab-general']})]
40
41 inlines = [CDNPrefixInline]
42
43 suit_form_tabs = (('general','Details'),('prefixes','CDN Prefixes'))
44
45class ServiceProviderAdmin(admin.ModelAdmin):
46 list_display = ('name', 'description', 'enabled')
47 fieldsets = [
48 (None, {'fields': ['name','description','enabled'], 'classes':['suit-tab suit-tab-general']})]
49#, ('Content Providers', {'fields':['contentProviders'],'classes':['suit-tab suit-tab-cps']})]
50
51 suit_form_tabs = (('general','Details'),('cps','Content Providers'))
52 inlines = [ContentProviderInline]
53
54class CDNPrefixForm(forms.ModelForm):
55 class Meta:
56 widgets = {
57 'contentProvider' : LinkedSelect
58 }
59
60class CDNPrefixAdmin(admin.ModelAdmin):
61 form = CDNPrefixForm
62 list_display = ['prefix','contentProvider']
63
64admin.site.register(ServiceProvider, ServiceProviderAdmin)
65admin.site.register(ContentProvider, ContentProviderAdmin)
66admin.site.register(CDNPrefix, CDNPrefixAdmin)
67admin.site.register(OriginServer,OriginServerAdmin)
Siobhan Tullycf04fb62014-01-11 11:25:57 -050068admin.site.register(HpcService)
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040069