remove unnecessary imports
[mygpo.git] / mygpo / api / admin.py
blob9c082abd73a4c28d29ca8bed543e2c657b8ca85d
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.contrib.auth.models import User
20 from mygpo.api.models import *
22 class DeviceInline(admin.TabularInline):
23 model = Device
24 extra = 3
26 class EpisodeInline(admin.TabularInline):
27 model = Episode
28 extra = 3
30 class EpisodeActionInline(admin.TabularInline):
31 model = EpisodeAction
32 extra = 3
34 class SubscriptionActionInline(admin.TabularInline):
35 model = SubscriptionAction
36 extra = 3
38 class SyncGroupAdmin(admin.ModelAdmin):
39 inlines = [DeviceInline]
41 class UserProfileInline(admin.StackedInline):
42 model = UserProfile
44 class UserProfileAdmin(admin.ModelAdmin):
45 inlines = [UserProfileInline, DeviceInline, EpisodeActionInline]
47 class PodcastAdmin(admin.ModelAdmin):
48 inlines = [EpisodeInline]
49 list_display = ['title', 'description', 'url', 'link', 'last_update', 'subscription_count']
51 class DeviceAdmin(admin.ModelAdmin):
52 inlines = [SubscriptionActionInline]
54 class SubscriptionAdmin(admin.ModelAdmin):
55 #empty ModelAdmin to work around bug 685
56 pass
58 class SubscriptionActionAdmin(admin.ModelAdmin):
59 #empty ModelAdmin to work around bug 685
60 pass
62 admin.site.unregister(User)
63 admin.site.register(User, UserProfileAdmin)
64 admin.site.register(Podcast, PodcastAdmin)
65 admin.site.register(SyncGroup, SyncGroupAdmin)
66 admin.site.register(Device, DeviceAdmin)
67 admin.site.register(Subscription, SubscriptionAdmin)
68 admin.site.register(SubscriptionAction, SubscriptionActionAdmin)
69 admin.site.register(EpisodeAction)
70 admin.site.register(URLSanitizingRule)