from django.forms import ModelForm
from dynastie.models import *

class BlogForm(ModelForm):
    class Meta:
        model = Blog

class PostForm(ModelForm):
    class Meta:
        model = Post
        exclude = ('title_slug', 'creation_date', 'modification_date', 'author', 'blog', 'tags')

    def __init__(self, *args, **kwargs):
        super(PostForm, self).__init__(*args, **kwargs)
        self.fields['category'].choices = [(cat.id, cat.name) for cat in Category.objects.all()]

class CategoryForm(ModelForm):
    class Meta:
        model = Category
        exclude = ('parent', 'name_slug', 'blog')

class UserForm(ModelForm):
    class Meta:
        model = User
        exclude = ('is_staff', 'is_active', 'last_login', 'last_joined', 'user_permissions', 'groups', 'date_joined')

class CommentForm(ModelForm):
    class Meta:
        model = Comment
        exclude = ('post', 'parent', 'date')