mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-01-05 13:39:06 +01:00
Fix some renaming issues from most recent merge
This commit is contained in:
parent
406ecf5411
commit
182d553356
@ -5,13 +5,13 @@ from django.db import models, migrations
|
|||||||
from helpdesk.settings import DEFAULT_USER_SETTINGS
|
from helpdesk.settings import DEFAULT_USER_SETTINGS
|
||||||
|
|
||||||
|
|
||||||
def picke_settings(data):
|
def pickle_settings(data):
|
||||||
"""Pickling as defined at migration's creation time"""
|
"""Pickling as defined at migration's creation time"""
|
||||||
try:
|
try:
|
||||||
import pickle
|
import pickle
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from helpdesk.lib import b64encode
|
from helpdesk.query import b64encode
|
||||||
return b64encode(pickle.dumps(data))
|
return b64encode(pickle.dumps(data))
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ def populate_usersettings(apps, schema_editor):
|
|||||||
# Import historical version of models
|
# Import historical version of models
|
||||||
UserSettings = apps.get_model("helpdesk", "UserSettings")
|
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():
|
for u in User.objects.all():
|
||||||
try:
|
try:
|
||||||
|
@ -98,7 +98,7 @@ class AttachmentUnitTests(TestCase):
|
|||||||
|
|
||||||
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
|
@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):
|
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]
|
filename, fileobj = lib.process_attachments(self.follow_up, [self.test_file])[0]
|
||||||
mock_att_save.assert_called_with(
|
mock_att_save.assert_called_with(
|
||||||
file=self.test_file,
|
file=self.test_file,
|
||||||
@ -111,7 +111,7 @@ class AttachmentUnitTests(TestCase):
|
|||||||
|
|
||||||
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
|
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
|
||||||
def test_autofill(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save):
|
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
|
self.follow_up.pk = 100
|
||||||
obj = models.FollowUpAttachment.objects.create(
|
obj = models.FollowUpAttachment.objects.create(
|
||||||
followup=self.follow_up,
|
followup=self.follow_up,
|
||||||
@ -122,7 +122,7 @@ class AttachmentUnitTests(TestCase):
|
|||||||
self.assertEqual(obj.mime_type, "text/plain")
|
self.assertEqual(obj.mime_type, "text/plain")
|
||||||
|
|
||||||
def test_kbi_attachment(self, mock_att_save, mock_queue_save, mock_ticket_save):
|
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(
|
kbcategory = models.KBCategory.objects.create(
|
||||||
title="Title",
|
title="Title",
|
||||||
|
@ -906,10 +906,21 @@ def ticket_list(request):
|
|||||||
|
|
||||||
urlsafe_query = query_to_base64(query_params)
|
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))
|
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 = ''
|
search_message = ''
|
||||||
if query_params['search_string'] and settings.DATABASES['default']['ENGINE'].endswith('sqlite'):
|
if query_params['search_string'] and settings.DATABASES['default']['ENGINE'].endswith('sqlite'):
|
||||||
search_message = _(
|
search_message = _(
|
||||||
@ -923,6 +934,7 @@ def ticket_list(request):
|
|||||||
|
|
||||||
return render(request, 'helpdesk/ticket_list.html', dict(
|
return render(request, 'helpdesk/ticket_list.html', dict(
|
||||||
context,
|
context,
|
||||||
|
tickets=ticket_qs,
|
||||||
default_tickets_per_page=request.user.usersettings_helpdesk.tickets_per_page,
|
default_tickets_per_page=request.user.usersettings_helpdesk.tickets_per_page,
|
||||||
user_choices=User.objects.filter(is_active=True, is_staff=True),
|
user_choices=User.objects.filter(is_active=True, is_staff=True),
|
||||||
queue_choices=huser.get_queues(),
|
queue_choices=huser.get_queues(),
|
||||||
|
Loading…
Reference in New Issue
Block a user