mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 09:50:45 +01:00
add KBCategory.name, improve KBCategory admin
This commit is contained in:
parent
07d6ee7f87
commit
5a594b7436
@ -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)
|
||||
|
33
helpdesk/migrations/0030_add_kbcategory_name.py
Normal file
33
helpdesk/migrations/0030_add_kbcategory_name.py
Normal file
@ -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'),
|
||||
),
|
||||
]
|
@ -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',)
|
||||
|
Loading…
Reference in New Issue
Block a user