forms.py 698 B

12345678910111213141516171819202122232425
  1. from django import forms
  2. from django.utils.translation import gettext_lazy as _
  3. from .models import UserReport
  4. class UserReportForm(forms.ModelForm):
  5. name = forms.CharField(
  6. max_length=128, widget=forms.TextInput(attrs={"placeholder": _("Jane Doe")})
  7. )
  8. email = forms.EmailField(
  9. max_length=75,
  10. widget=forms.TextInput(
  11. attrs={"placeholder": _("jane@example.com"), "type": "email"}
  12. ),
  13. )
  14. comments = forms.CharField(
  15. widget=forms.Textarea(
  16. attrs={"placeholder": _("I clicked on 'X' and then hit 'Confirm'")}
  17. )
  18. )
  19. class Meta:
  20. model = UserReport
  21. fields = ("name", "email", "comments")