46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
from django import forms
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
from web.models.custom_user import CustomUser
|
|
from markdownx.fields import MarkdownxFormField
|
|
|
|
|
|
class SignupForm(UserCreationForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
for field_name in self.fields:
|
|
self.fields[field_name].help_text = ''
|
|
|
|
url = forms.URLField(max_length=200, help_text='Required')
|
|
description = forms.CharField(widget=forms.Textarea)
|
|
rule_conf = forms.BooleanField(label='Have you read the rules?')
|
|
rule_conf.widget.attrs.update({'class': 'checkmark'})
|
|
comments = forms.CharField(widget=forms.Textarea)
|
|
|
|
class Meta:
|
|
model = CustomUser
|
|
fields = (
|
|
'username',
|
|
'email',
|
|
'password1',
|
|
'password2',
|
|
'url',
|
|
'description',
|
|
'rule_conf',
|
|
'comments'
|
|
)
|
|
|
|
|
|
class EditProfileForm(forms.Form):
|
|
avatar = forms.ImageField(allow_empty_file=True, validators=)
|
|
url = forms.URLField(max_length=200, help_text='Required')
|
|
description = forms.CharField(widget=forms.Textarea)
|
|
|
|
|
|
|
|
class ThreadPostForm(forms.Form):
|
|
content = MarkdownxFormField()
|
|
|
|
class Meta:
|
|
fields = ('content')
|
|
|