28 lines
848 B
Python
28 lines
848 B
Python
from django import forms
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
from django.contrib.auth.models import User
|
|
from .models import Post
|
|
|
|
class SignUpForm(UserCreationForm):
|
|
email = forms.EmailField(max_length=254, help_text='Required. Inform a valid email address.')
|
|
|
|
class Meta:
|
|
model = User
|
|
fields = ('username', 'email', 'password', 'password2')
|
|
|
|
class PostForm(forms.ModelForm):
|
|
content = forms.CharField(
|
|
widget=forms.Textarea(
|
|
attrs={
|
|
"class": "w-full bg-gray-800 border border-gray-700 rounded-lg p-4 text-white focus:outline-none focus:ring-2 focus:ring-teal-500",
|
|
"placeholder": "What's on your mind?",
|
|
"rows": 3,
|
|
}
|
|
),
|
|
label="",
|
|
)
|
|
|
|
class Meta:
|
|
model = Post
|
|
fields = ["content"]
|