Add Profiles app to the admin page.
This commit is contained in:
parent
616b7308cf
commit
0607d26685
1 changed files with 44 additions and 1 deletions
|
@ -1,3 +1,46 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import RadioProfile, SongRequest
|
||||
|
||||
|
||||
class FavoriteInline(admin.TabularInline):
|
||||
model = RadioProfile.favorites.through
|
||||
verbose_name = 'favorite'
|
||||
verbose_name_plural = 'favorites'
|
||||
extra = 0
|
||||
|
||||
|
||||
class RatingInline(admin.TabularInline):
|
||||
model = RadioProfile.ratings.through
|
||||
verbose_name = 'rating'
|
||||
verbose_name_plural = 'ratings'
|
||||
extra = 0
|
||||
|
||||
|
||||
@admin.register(RadioProfile)
|
||||
class ProfileAdmin(admin.ModelAdmin):
|
||||
# Edit Form display
|
||||
readonly_fields = ('created_date', 'modified_date')
|
||||
fieldsets = (
|
||||
('Main', {
|
||||
'fields': ('user',)
|
||||
}),
|
||||
('Stats', {
|
||||
'classes': ('collapse',),
|
||||
'fields': ('created_date', 'modified_date')
|
||||
})
|
||||
)
|
||||
can_delete = False
|
||||
verbose_name = 'profile'
|
||||
verbose_name_plural = 'profiles'
|
||||
extra = 0
|
||||
|
||||
inlines = [FavoriteInline, RatingInline]
|
||||
|
||||
|
||||
@admin.register(SongRequest)
|
||||
class RequestAdmin(admin.ModelAdmin):
|
||||
model = SongRequest
|
||||
verbose_name = 'request'
|
||||
verbose_name_plural = 'requests'
|
||||
extra = 0
|
||||
|
|
Loading…
Reference in a new issue