Corp/backend/feed/forms.py
Игорь Надеин a42204dda0 0
2025-08-05 15:30:41 +03:00

26 lines
909 B
Python

from django import forms
from .models import Post, Comment
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ['type', 'department', 'title', 'body', 'image', 'attachment']
widgets = {
'type': forms.Select(attrs={'class': 'form-select'}),
'department': forms.Select(attrs={'class': 'form-select'}),
'title': forms.TextInput(attrs={'class': 'form-control'}),
'body': forms.Textarea(attrs={'class': 'form-control', 'rows': 5}),
'image': forms.ClearableFileInput(attrs={'class': 'form-control'}),
'attachment': forms.ClearableFileInput(attrs={'class': 'form-control'}),
}
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ['text']
widgets = {
'text': forms.Textarea(attrs={'class': 'form-control', 'rows': 3}),
}