from django import forms
from django.forms import ModelForm, Textarea
from blogapp.models import blogentry, blogcomment, blogcategory
from django.contrib import admin

class blogentryAdminForm(forms.ModelForm):
    class Meta:
        model = blogentry
        fields = '__all__'
        widgets = {
            'intro': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
            'body': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
        }


class blogcategoryAdminForm(forms.ModelForm):
    class Meta:
        model = blogcategory
        fields = '__all__'

class blogentryAdmin(admin.ModelAdmin):
	form = blogentryAdminForm
	list_display = ('header', )

class blogcommentAdmin(admin.ModelAdmin):
	list_display = ('date', )

class blogcategoryAdmin(admin.ModelAdmin):
    form = blogentryAdminForm
    list_display = ('name',)

admin.site.register(blogentry, blogentryAdmin)
admin.site.register(blogcomment, blogcommentAdmin)
admin.site.register(blogcategory, blogcategoryAdmin)
