Fix some renaming issues from most recent merge

This commit is contained in:
Garret Wassermann 2019-10-12 18:58:50 -04:00
parent 406ecf5411
commit 182d553356
3 changed files with 19 additions and 7 deletions

View File

@ -5,13 +5,13 @@ from django.db import models, migrations
from helpdesk.settings import DEFAULT_USER_SETTINGS
def picke_settings(data):
def pickle_settings(data):
"""Pickling as defined at migration's creation time"""
try:
import pickle
except ImportError:
import cPickle as pickle
from helpdesk.lib import b64encode
from helpdesk.query import b64encode
return b64encode(pickle.dumps(data))
@ -27,7 +27,7 @@ def populate_usersettings(apps, schema_editor):
# Import historical version of models
UserSettings = apps.get_model("helpdesk", "UserSettings")
settings_pickled = picke_settings(DEFAULT_USER_SETTINGS)
settings_pickled = pickle_settings(DEFAULT_USER_SETTINGS)
for u in User.objects.all():
try:

View File

@ -98,7 +98,7 @@ class AttachmentUnitTests(TestCase):
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
def test_unicode_attachment_filename(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save):
""" check utf-8 data is parsed correcltly """
""" check utf-8 data is parsed correctly """
filename, fileobj = lib.process_attachments(self.follow_up, [self.test_file])[0]
mock_att_save.assert_called_with(
file=self.test_file,
@ -111,7 +111,7 @@ class AttachmentUnitTests(TestCase):
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
def test_autofill(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save):
""" check utf-8 data is parsed correcltly """
""" check utf-8 data is parsed correctly """
self.follow_up.pk = 100
obj = models.FollowUpAttachment.objects.create(
followup=self.follow_up,
@ -122,7 +122,7 @@ class AttachmentUnitTests(TestCase):
self.assertEqual(obj.mime_type, "text/plain")
def test_kbi_attachment(self, mock_att_save, mock_queue_save, mock_ticket_save):
""" check utf-8 data is parsed correcltly """
""" check utf-8 data is parsed correctly """
kbcategory = models.KBCategory.objects.create(
title="Title",

View File

@ -906,9 +906,20 @@ def ticket_list(request):
urlsafe_query = query_to_base64(query_params)
get_query(urlsafe_query, huser)
tickets_base = get_query(urlsafe_query, huser)
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
ticket_qs = None
try:
ticket_qs = apply_query(tickets_base, query_params)
except ValidationError:
# invalid parameters in query, return default query
query_params = {
'filtering': {'status__in': [1, 2, 3]},
'sorting': 'created',
}
ticket_qs = apply_query(tickets_base, query_params)
search_message = ''
if query_params['search_string'] and settings.DATABASES['default']['ENGINE'].endswith('sqlite'):
@ -923,6 +934,7 @@ def ticket_list(request):
return render(request, 'helpdesk/ticket_list.html', dict(
context,
tickets=ticket_qs,
default_tickets_per_page=request.user.usersettings_helpdesk.tickets_per_page,
user_choices=User.objects.filter(is_active=True, is_staff=True),
queue_choices=huser.get_queues(),