Skip to content

Instantly share code, notes, and snippets.

@vitorfs vitorfs/forms.py Secret
Created Sep 30, 2017

Embed
What would you like to do?
from django import forms
from .models import Topic, Post
class NewTopicForm(forms.ModelForm):
message = forms.CharField(
widget=forms.Textarea(
attrs={'rows': 5, 'placeholder': 'What is in your mind?'}
),
max_length=4000,
help_text='The max length of the text is 4000.'
)
class Meta:
model = Topic
fields = ['subject', 'message']
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ['message', ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.