24 lines
609 B
Python
24 lines
609 B
Python
from django import forms
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
from .models import Article, Reflection
|
|
|
|
|
|
class SignUpForm(UserCreationForm):
|
|
class Meta(UserCreationForm.Meta):
|
|
fields = ("username", "email")
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(SignUpForm, self).__init__(*args, **kwargs)
|
|
self.fields['email'].required = True
|
|
|
|
|
|
class ArticleForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Article
|
|
fields = ('title', 'content')
|
|
|
|
class ReflectionForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Reflection
|
|
fields = ('answer',)
|