Fix pycodestyle errors

This commit is contained in:
Timothy Hobbs 2020-01-08 20:38:08 +01:00
parent 6a8ebd56a0
commit 05bd852799
3 changed files with 8 additions and 9 deletions

View File

@ -180,14 +180,13 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
def __init__(self, kbcategory=None, *args, **kwargs):
super().__init__(*args, **kwargs)
if kbcategory:
self.fields['kbitem'] = forms.ChoiceField(
self.fields['kbitem'] = forms.ChoiceField(
widget=forms.Select(attrs={'class': 'form-control'}),
required=False,
label=_('Knowedge Base Item'),
choices=[(kbi.pk, kbi.title) for kbi in KBItem.objects.filter(category=kbcategory.pk)],
)
def _add_form_custom_fields(self, staff_only_filter=None):
if staff_only_filter is None:
queryset = CustomField.objects.all()
@ -195,8 +194,11 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
queryset = CustomField.objects.filter(staff_only=staff_only_filter)
for field in queryset:
instanceargs = { 'label': field.label, 'help_text':
field.help_text, 'required': field.required, }
instanceargs = {
'label': field.label,
'help_text': field.help_text,
'required': field.required,
}
self.customfield_to_field(field, instanceargs)

View File

@ -1232,7 +1232,6 @@ class KBCategory(models.Model):
verbose_name=_('Default queue when creating a ticket after viewing this category.'),
)
def __str__(self):
return '%s' % self.title
@ -1318,12 +1317,11 @@ class KBItem(models.Model):
def get_absolute_url(self):
from django.urls import reverse
return str(reverse('helpdesk:kb_category', args=(self.category.slug,)))+"?kbitem="+str(self.pk)
return str(reverse('helpdesk:kb_category', args=(self.category.slug,))) + "?kbitem=" + str(self.pk)
def query_url(self):
from django.urls import reverse
return str(reverse('helpdesk:list')) +"?kbitem="+str(self.pk)
return str(reverse('helpdesk:list')) + "?kbitem=" + str(self.pk)
def get_markdown(self):
return get_markdown(self.answer)

View File

@ -14,7 +14,6 @@ class AbstractCreateTicketMixin():
if request.user.is_authenticated and request.user.usersettings_helpdesk.use_email_as_submitter and request.user.email:
initial_data['submitter_email'] = request.user.email
query_param_fields = ['submitter_email', 'title', 'body', 'queue', 'kbitem']
custom_fields = ["custom_%s" % f.name for f in CustomField.objects.filter(staff_only=False)]
query_param_fields += custom_fields