from django.contrib import admin

from .models import Artist, Song


admin.AdminSite.site_title = 'Chords administration'
admin.AdminSite.site_header = 'Chords Administration'


class ArtistAdmin(admin.ModelAdmin):
    exclude = ['slug']


class SongAdmin(admin.ModelAdmin):
    fieldsets = [
        ('General',               {'fields': ['title', 'artist', 'genre']}),
        ('User information', {'fields': ['sender'], 'classes': ['collapse']}),
        ('Content',               {'fields': ['content', 'tabs', 'video']}),
        ('Published', {'fields': ['published']}),
    ]

    list_display = ['full_title', 'reg_date', 'pub_date', 'published']

    list_filter = ['pub_date', 'reg_date', 'genre', 'tabs']

    search_fields = ['sender__username', 'artist__name']


admin.site.register(Artist, ArtistAdmin)
admin.site.register(Song, SongAdmin)

@@ -170,17 +170,16 @@
 ation'%0A%0A
-%0A
 class Ar
@@ -646,17 +646,16 @@
 ished'%5D%0A
-%0A
     list
@@ -706,17 +706,16 @@
 'tabs'%5D%0A
-%0A
     sear
@@ -763,16 +763,386 @@
 _name'%5D%0A
+    actions = %5B'publish_songs', 'unpublish_songs'%5D%0A%0A    def publish_songs(self, request, queryset):%0A        queryset.update(published=True)%0A    publish_songs.short_description = 'Publish all selected songs'%0A%0A    def unpublish_songs(self, request, queryset):%0A        queryset.update(published=False)%0A    unpublish_songs.short_description = 'Unpublish all selected songs'%0A
 %0A%0Aadmin.

add publish and unpublish admin actions