From 7894eea1e184a58adb469a5728bc59daede7b9f4 Mon Sep 17 00:00:00 2001 From: Alex Barcelo Date: Fri, 18 Dec 2015 14:56:53 +0100 Subject: [PATCH] Making Queue slug unique and improving certain admin-related behaviour --- helpdesk/admin.py | 1 + .../0011_admin_related_improvements.py | 24 +++++++++++++++++++ helpdesk/models.py | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 helpdesk/migrations/0011_admin_related_improvements.py diff --git a/helpdesk/admin.py b/helpdesk/admin.py index e0c09d9e..5529f2b6 100644 --- a/helpdesk/admin.py +++ b/helpdesk/admin.py @@ -7,6 +7,7 @@ from helpdesk.models import CustomField class QueueAdmin(admin.ModelAdmin): list_display = ('title', 'slug', 'email_address', 'locale') + prepopulated_fields = {"slug": ("title",)} class TicketAdmin(admin.ModelAdmin): list_display = ('title', 'status', 'assigned_to', 'queue', 'hidden_submitter_email',) diff --git a/helpdesk/migrations/0011_admin_related_improvements.py b/helpdesk/migrations/0011_admin_related_improvements.py new file mode 100644 index 00000000..a36ff1fb --- /dev/null +++ b/helpdesk/migrations/0011_admin_related_improvements.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('helpdesk', '0010_remove_queuemembership'), + ] + + operations = [ + migrations.AlterField( + model_name='queue', + name='permission_name', + field=models.CharField(editable=False, max_length=50, blank=True, help_text='Name used in the django.contrib.auth permission system', null=True, verbose_name='Django auth permission name'), + ), + migrations.AlterField( + model_name='queue', + name='slug', + field=models.SlugField(help_text="This slug is used when building ticket ID's. Once set, try not to change it or e-mailing may get messy.", unique=True, verbose_name='Slug'), + ), + ] diff --git a/helpdesk/models.py b/helpdesk/models.py index 1d533e52..3ca61b92 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -45,6 +45,7 @@ class Queue(models.Model): slug = models.SlugField( _('Slug'), max_length=50, + unique=True, help_text=_('This slug is used when building ticket ID\'s. Once set, ' 'try not to change it or e-mailing may get messy.'), ) @@ -179,6 +180,7 @@ class Queue(models.Model): max_length=50, blank=True, null=True, + editable=False, help_text=_('Name used in the django.contrib.auth permission system'), )