Update forms.py and views/public.py to physically delete form fields
instead of just hiding them if default values for queue, date and priority are provided.
+ some bugfixes
+ code and stale imports removal
+ fix pep8 errors
Before: we set initial value for the widget and had it hidden. So user could still change the queue with some HTML knowledge.
Now: we drop the field at all and assign queue directly, utterly ignoring the POST request content for "queue" field.
This refactor removes duplicated logic for deciding whom the messages get sent to.
It also normalizes behavior ensuring that all CCed addresses are sent to in all cases that CCed individuals should be notified.
This commit adds three new settings that allow the operator to
pre-define the `queue`, `priority` and `due_date` fields for public
tickets. If one of these settings are present the corresponding input
field is hidden from the form.
The settings are the following:
HELPDESK_PUBLIC_TICKET_QUEUE = 'website'
HELPDESK_PUBLIC_TICKET_PRIORITY = 2
HELPDESK_PUBLIC_TICKET_DUE_DATE = ''
If the due date is set to the empty string, no due date is saved in the
ticket (analogously to the form). The other settings should be
self-explanatory.
Extract attachment processing from forms, views.staff, and management.command.get_email modules, and consolidate it into a unified lib module function.
Also refactor the affected components, most notably lib.send_templated_email, to make it easier (IMO) to reason about changes to them.
Add unit tests for attachments with UTF-8 filenames, and functional tests for submission of same, as well as ASCII versions, through the public ticket-form.
Remove unused Attachment method "get_upload_to".
ugettext() loads the translations at the same time the module is loaded (--> always in english).
ugettext_lazy() loads them when they are needed (--> when the user makes a query --> we known the language the user wants based on the header of their HTTP request)
Signed-off-by: Jerome Flesch <jflesch@gmail.com>