From f434292cfc53daf4b0df9f726c15336c0282bbcc Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Wed, 3 Jun 2015 12:39:02 +0700 Subject: [PATCH 1/5] Remove migration 0002_socks_proxy.py which has been squashed into 0001, rename migrations 0003 and 0004 and update their dependencies accordingly --- ...tings.py => 0002_populate_usersettings.py} | 2 +- helpdesk/migrations/0002_socks_proxy.py | 32 ------------------- ..._import.py => 0003_initial_data_import.py} | 2 +- 3 files changed, 2 insertions(+), 34 deletions(-) rename helpdesk/migrations/{0003_populate_usersettings.py => 0002_populate_usersettings.py} (97%) delete mode 100644 helpdesk/migrations/0002_socks_proxy.py rename helpdesk/migrations/{0004_initial_data_import.py => 0003_initial_data_import.py} (95%) diff --git a/helpdesk/migrations/0003_populate_usersettings.py b/helpdesk/migrations/0002_populate_usersettings.py similarity index 97% rename from helpdesk/migrations/0003_populate_usersettings.py rename to helpdesk/migrations/0002_populate_usersettings.py index 36b98310..ba2979be 100644 --- a/helpdesk/migrations/0003_populate_usersettings.py +++ b/helpdesk/migrations/0002_populate_usersettings.py @@ -43,7 +43,7 @@ noop = lambda *args, **kwargs: None class Migration(migrations.Migration): dependencies = [ - ('helpdesk', '0002_socks_proxy'), + ('helpdesk', '0001_initial'), ] operations = [ diff --git a/helpdesk/migrations/0002_socks_proxy.py b/helpdesk/migrations/0002_socks_proxy.py deleted file mode 100644 index 468af823..00000000 --- a/helpdesk/migrations/0002_socks_proxy.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('helpdesk', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='queue', - name='socks_proxy_host', - field=models.GenericIPAddressField(help_text='Socks proxy IP address. Default: 127.0.0.1', null=True, verbose_name='Socks Proxy Host', blank=True), - preserve_default=True, - ), - migrations.AddField( - model_name='queue', - name='socks_proxy_port', - field=models.IntegerField(help_text='Socks proxy port number. Default: 9150 (default TOR port)', null=True, verbose_name='Socks Proxy Port', blank=True), - preserve_default=True, - ), - migrations.AddField( - model_name='queue', - name='socks_proxy_type', - field=models.CharField(choices=[(b'socks4', 'SOCKS4'), (b'socks5', 'SOCKS5')], max_length=8, blank=True, help_text='SOCKS4 or SOCKS5 allows you to proxy your connections through a SOCKS server.', null=True, verbose_name='Socks Proxy Type'), - preserve_default=True, - ), - ] diff --git a/helpdesk/migrations/0004_initial_data_import.py b/helpdesk/migrations/0003_initial_data_import.py similarity index 95% rename from helpdesk/migrations/0004_initial_data_import.py rename to helpdesk/migrations/0003_initial_data_import.py index e64f4112..566993e0 100644 --- a/helpdesk/migrations/0004_initial_data_import.py +++ b/helpdesk/migrations/0003_initial_data_import.py @@ -36,7 +36,7 @@ def unload_fixture(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('helpdesk', '0003_populate_usersettings'), + ('helpdesk', '0002_populate_usersettings'), ] operations = [ From caa1ec242a7d871cff772a417268f98f5635e653 Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Wed, 3 Jun 2015 13:04:46 +0700 Subject: [PATCH 2/5] Update install.rst Change example urls.py URL patterns from raw tuples to url(...) calls, for Django 1.8 (and possibly 1.5+) compatibility. --- docs/install.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/install.rst b/docs/install.rst index f386ea38..bb7d4334 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -46,11 +46,11 @@ Adding To Your Django Project 2. Make sure django-helpdesk is accessible via ``urls.py``. Add the following line to ``urls.py``:: - (r'helpdesk/', include('helpdesk.urls')), + url(r'helpdesk/', include('helpdesk.urls')), Note that you can change 'helpdesk/' to anything you like, such as 'support/' or 'help/'. If you want django-helpdesk to be available at the root of your site (for example at http://support.mysite.tld/) then the line will be as follows:: - (r'', include('helpdesk.urls')), + url(r'', include('helpdesk.urls')), This line will have to come *after* any other lines in your urls.py such as those used by the Django admin. From 9c60350193b1a9c23dbaf9c4404fbcc29e684876 Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Wed, 3 Jun 2015 14:17:06 +0700 Subject: [PATCH 3/5] Fix issue 286: Header cuts off body by replacing {{ STATIC_URL }}x with {% static "x" %} in {public_,}base.html --- helpdesk/templates/helpdesk/base.html | 11 ++++++----- helpdesk/templates/helpdesk/public_base.html | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 9f9e1eb7..433c825c 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -1,6 +1,7 @@ {% load i18n %} {% load saved_queries %} {% load load_helpdesk_settings %} +{% load static from staticfiles %} {% with request|load_helpdesk_settings as helpdesk_settings %} {% with user|saved_queries as user_saved_queries_ %} @@ -9,11 +10,11 @@ {% block helpdesk_title %}Helpdesk{% endblock %} :: {% trans "Powered by django-helpdesk" %} - - + + - - + + @@ -58,7 +59,7 @@ diff --git a/helpdesk/templates/helpdesk/public_base.html b/helpdesk/templates/helpdesk/public_base.html index d1c4e265..b78c2fe3 100644 --- a/helpdesk/templates/helpdesk/public_base.html +++ b/helpdesk/templates/helpdesk/public_base.html @@ -1,6 +1,7 @@ {% load i18n %} {% load url from future %} {% load load_helpdesk_settings %} +{% load static from staticfiles %} {% with request|load_helpdesk_settings as helpdesk_settings %} @@ -8,7 +9,7 @@ - + {% block helpdesk_head %}{% endblock %} From fd6988aad7faaece0ba7eb835a9620a608d2f7a6 Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Wed, 3 Jun 2015 15:42:35 +0700 Subject: [PATCH 4/5] Add STATIC_URL setting to quicktest.py so that tests pass for Django versions 1.5 through 1.7 --- quicktest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/quicktest.py b/quicktest.py index d49084b9..78724ec2 100644 --- a/quicktest.py +++ b/quicktest.py @@ -90,6 +90,7 @@ class QuickDjangoTest(object): INSTALLED_APPS = self.INSTALLED_APPS + self.apps, MIDDLEWARE_CLASSES = self.MIDDLEWARE_CLASSES, ROOT_URLCONF = self.apps[0] + '.urls', + STATIC_URL = '/static/' ) if django.VERSION >= (1, 7): From 711eb6cea212af7dd46a26d7e7ea4cce123ed32f Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Thu, 4 Jun 2015 13:04:14 +0700 Subject: [PATCH 5/5] As of at least Django 1.5, calling __str__() on a CHOICES object returns a proxy object, not the actual text of the CHOICE. Change such calls to title() instead --- helpdesk/views/staff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index b36bd5d5..0ea21497 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -1013,7 +1013,7 @@ def run_report(request, report): if report == 'userpriority': title = _('User by Priority') col1heading = _('User') - possible_options = [t[1].__str__() for t in Ticket.PRIORITY_CHOICES] + possible_options = [t[1].title() for t in Ticket.PRIORITY_CHOICES] charttype = 'bar' elif report == 'userqueue': @@ -1025,7 +1025,7 @@ def run_report(request, report): elif report == 'userstatus': title = _('User by Status') col1heading = _('User') - possible_options = [s[1].__str__() for s in Ticket.STATUS_CHOICES] + possible_options = [s[1].title() for s in Ticket.STATUS_CHOICES] charttype = 'bar' elif report == 'usermonth': @@ -1037,13 +1037,13 @@ def run_report(request, report): elif report == 'queuepriority': title = _('Queue by Priority') col1heading = _('Queue') - possible_options = [t[1].__str__() for t in Ticket.PRIORITY_CHOICES] + possible_options = [t[1].title() for t in Ticket.PRIORITY_CHOICES] charttype = 'bar' elif report == 'queuestatus': title = _('Queue by Status') col1heading = _('Queue') - possible_options = [s[1].__str__() for s in Ticket.STATUS_CHOICES] + possible_options = [s[1].title() for s in Ticket.STATUS_CHOICES] charttype = 'bar' elif report == 'queuemonth':