from import_export.admin import ImportExportModelAdmin  # Réactivé pour test
from django.contrib import admin
from blog.models import *

def bt_b_publier(modeladmin, request, queryset):
	queryset.update(b_publier=True)
bt_b_publier.short_description = "Passer en Public"
def bt_b_not_publier(modeladmin, request, queryset):
	queryset.update(b_publier=False)
bt_b_not_publier.short_description = "Passer en Priver"

class Blog_Admin(ImportExportModelAdmin):  # Réactivé
	form = Blog_Admin_Form
	list_display = ('b_titre', 'b_description', 'b_publier','b_publdate','b_reading')
	list_filter = ('b_publier','b_cat','b_publdate')
	filter_horizontal = ('b_cat',)
	actions = [bt_b_publier, bt_b_not_publier]
	search_fields = ['b_titre','b_contenu']
admin.site.register(Blog, Blog_Admin)

class Cat_Blog_Admin(admin.ModelAdmin):
	list_display = ('cb_titre', 'cb_titre_slgify')
	pass
admin.site.register(Cat_Blog, Cat_Blog_Admin)


