Skip to content

Switch ZendeskForm to ModelForm#7265

Open
denyshon wants to merge 1 commit intomozilla:mainfrom
denyshon:zendeskfrom-to-modelform
Open

Switch ZendeskForm to ModelForm#7265
denyshon wants to merge 1 commit intomozilla:mainfrom
denyshon:zendeskfrom-to-modelform

Conversation

@denyshon
Copy link
Copy Markdown
Contributor

@denyshon denyshon commented Feb 19, 2026

  • Switch ZendeskForm from Form to ModelForm to benefit from model validation.
  • Specify SupportTicket.description max_length based on the Zendesk API.
  • Set blank=True for SupportTicket.category to prevent a model validation error in case we decide to make this field optional.
  • Adjust kitsune.customercare.tests.test_forms.ZendeskFormTests.test_send_with_no_category_selected to ignore a form validation error.

Resolves #2806.

@denyshon denyshon force-pushed the zendeskfrom-to-modelform branch 4 times, most recently from 731da2d to 5a3a57e Compare February 21, 2026 15:32
Copy link
Copy Markdown
Collaborator

@akatsoulas akatsoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @denyshon for the PR! I added a couple of comment

"description": "Test description",
"category": "", # Empty category
}
# An empty category field will result in a form validation error in send()->save().
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the change in the model, the empty category shouldn't raise a validation error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akatsoulas It raises a form (not model) validation error, because the field is still required (and from the form perspective cannot be empty)

@denyshon denyshon force-pushed the zendeskfrom-to-modelform branch from 5a3a57e to 6c2d272 Compare March 6, 2026 21:36
Switch ZendeskForm from Form to ModelForm to benefit from model validation.
Specify SupportTicket.description max_length based on the Zendesk API.
Set blank=True for SupportTicket.category to prevent a model validation error in case we decide to make this field optional.
Adjust kitsune.customercare.tests.test_forms.ZendeskFormTests.test_send_with_no_category_selected to ignore a form validation error.
@denyshon denyshon force-pushed the zendeskfrom-to-modelform branch from 6c2d272 to 7f286c9 Compare March 6, 2026 22:42
@denyshon
Copy link
Copy Markdown
Contributor Author

denyshon commented Mar 7, 2026

@akatsoulas Thank you for the review! I've replied to your comment and rebased the patch onto the latest main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

500 error message when trying to submit a ticket with a long subject for a premium product

2 participants