mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-10 08:27:59 +02:00
Add HELPDESK_ENABLE_ATTACHMENTS setting and make it show/hide attachment related UI
Default setting is false. This is not backward compatible. The rationale is: attachments contain most likely sensitive information. By default they are served without access control. Currently there is no simple feature to configure access control. To avoid unintentional disclosure attachments should be an opt in: you have been warned.
This commit is contained in:
@ -239,17 +239,18 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
||||
label=_('Due on'),
|
||||
)
|
||||
|
||||
attachment = forms.FileField(
|
||||
widget=forms.FileInput(attrs={'class': 'form-control-file'}),
|
||||
required=False,
|
||||
label=_('Attach File'),
|
||||
help_text=_('You can attach a file to this ticket. '
|
||||
'Only file types such as plain text (.txt), '
|
||||
'a document (.pdf, .docx, or .odt), '
|
||||
'or screenshot (.png or .jpg) may be uploaded.'),
|
||||
validators=[validate_file_extension]
|
||||
)
|
||||
|
||||
if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS:
|
||||
attachment = forms.FileField(
|
||||
widget=forms.FileInput(attrs={'class': 'form-control-file'}),
|
||||
required=False,
|
||||
label=_('Attach File'),
|
||||
help_text=_('You can attach a file to this ticket. '
|
||||
'Only file types such as plain text (.txt), '
|
||||
'a document (.pdf, .docx, or .odt), '
|
||||
'or screenshot (.png or .jpg) may be uploaded.'),
|
||||
validators=[validate_file_extension]
|
||||
)
|
||||
|
||||
class Media:
|
||||
js = ('helpdesk/js/init_due_date.js',
|
||||
'helpdesk/js/init_datetime_classes.js')
|
||||
|
Reference in New Issue
Block a user