2012-07-08 16:23:39 +02:00
|
|
|
from django.forms import ModelForm
|
|
|
|
from dynastie.models import *
|
|
|
|
|
|
|
|
class BlogForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Blog
|
|
|
|
|
|
|
|
class ArticleForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Article
|
2012-07-22 10:47:24 +02:00
|
|
|
exclude = ('title_slug', 'creation_date', 'author', 'blog', 'tags')
|
2012-07-08 16:23:39 +02:00
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(ArticleForm, 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
|
2012-07-22 19:07:02 +02:00
|
|
|
exclude = ('parent', 'name_slug')
|
2012-07-08 16:23:39 +02:00
|
|
|
|
|
|
|
class UserForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
exclude = ('is_staff', 'is_active', 'last_login', 'last_joined', 'user_permissions', 'groups', 'date_joined')
|