2 # This file is part of my.gpodder.org.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
18 from django
.contrib
import admin
19 from django
import forms
20 from django
.contrib
.auth
.models
import User
21 from django
.contrib
.auth
.admin
import UserAdmin
22 from mygpo
.api
.models
import *
24 class DeviceInline(admin
.TabularInline
):
28 class EpisodeInline(admin
.TabularInline
):
32 class EpisodeActionInline(admin
.TabularInline
):
36 class SubscriptionActionInline(admin
.TabularInline
):
37 model
= SubscriptionAction
40 class SyncGroupAdmin(admin
.ModelAdmin
):
41 inlines
= [DeviceInline
]
43 class UserProfileInline(admin
.StackedInline
):
46 class UserProfileAdmin(admin
.ModelAdmin
):
47 inlines
= [UserProfileInline
, DeviceInline
, EpisodeActionInline
]
49 class PodcastAdmin(admin
.ModelAdmin
):
50 inlines
= [EpisodeInline
]
51 list_display
= ['title', 'description', 'url', 'link', 'last_update', 'subscription_count']
53 class DeviceAdmin(admin
.ModelAdmin
):
54 inlines
= [SubscriptionActionInline
]
56 class SubscriptionAdmin(admin
.ModelAdmin
):
57 #empty ModelAdmin to work around bug 685
60 class SubscriptionActionAdmin(admin
.ModelAdmin
):
61 #empty ModelAdmin to work around bug 685
64 admin
.site
.unregister(User
)
65 admin
.site
.register(User
, UserProfileAdmin
)
66 admin
.site
.register(Podcast
, PodcastAdmin
)
67 admin
.site
.register(SyncGroup
, SyncGroupAdmin
)
68 admin
.site
.register(Device
, DeviceAdmin
)
69 admin
.site
.register(Subscription
, SubscriptionAdmin
)
70 admin
.site
.register(SubscriptionAction
, SubscriptionActionAdmin
)
71 admin
.site
.register(EpisodeAction
)
72 admin
.site
.register(URLSanitizingRule
)