diff --git a/helpdesk/admin.py b/helpdesk/admin.py index 5530aa51..88086130 100644 --- a/helpdesk/admin.py +++ b/helpdesk/admin.py @@ -93,6 +93,10 @@ class IgnoreEmailAdmin(admin.ModelAdmin): list_display = ('name', 'queue_list', 'email_address', 'keep_in_mailbox') +@admin.register(KBCategory) +class KBCategoryAdmin(admin.ModelAdmin): + list_display = ('name', 'title', 'slug', ) + + admin.site.register(PreSetReply) admin.site.register(EscalationExclusion) -admin.site.register(KBCategory) diff --git a/helpdesk/migrations/0030_add_kbcategory_name.py b/helpdesk/migrations/0030_add_kbcategory_name.py new file mode 100644 index 00000000..908fdf17 --- /dev/null +++ b/helpdesk/migrations/0030_add_kbcategory_name.py @@ -0,0 +1,33 @@ +# Generated by Django 2.2.10 on 2020-02-25 11:21 + +from django.db import migrations, models + +def copy_title(apps, schema_editor): + KBCategory = apps.get_model("helpdesk", "KBCategory") + KBCategory.objects.update(name=models.F('title')) + + +class Migration(migrations.Migration): + + dependencies = [ + ('helpdesk', '0029_kbcategory_public'), + ] + + operations = [ + migrations.AddField( + model_name='kbcategory', + name='name', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Name of the category'), + ), + migrations.AlterField( + model_name='kbcategory', + name='title', + field=models.CharField(max_length=100, verbose_name='Title on knowledgebase page'), + ), + migrations.RunPython(copy_title, migrations.RunPython.noop), + migrations.AlterField( + model_name='kbcategory', + name='name', + field=models.CharField(blank=False, max_length=100, null=False, verbose_name='Name of the category'), + ), + ] diff --git a/helpdesk/models.py b/helpdesk/models.py index a36c5a78..409721f7 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1215,8 +1215,13 @@ class KBCategory(models.Model): listing of questions & answers. """ + name = models.CharField( + _('Name of the category'), + max_length=100, + ) + title = models.CharField( - _('Title'), + _('Title on knowledgebase page'), max_length=100, ) @@ -1242,7 +1247,7 @@ class KBCategory(models.Model): ) def __str__(self): - return '%s' % self.title + return '%s' % self.name class Meta: ordering = ('title',)