forms.py 697 B

123456789101112131415161718192021222324
  1. from django.utils.translation import gettext_lazy as _
  2. from django import forms
  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")