diff --git a/helpdesk/admin.py b/helpdesk/admin.py index 88086130..8b1dedf9 100644 --- a/helpdesk/admin.py +++ b/helpdesk/admin.py @@ -70,7 +70,7 @@ class FollowUpAdmin(admin.ModelAdmin): @admin.register(KBItem) class KBItemAdmin(admin.ModelAdmin): - list_display = ('category', 'title', 'last_updated', 'team', ) + list_display = ('category', 'title', 'last_updated', 'team', 'order') inlines = [KBIAttachmentInline] readonly_fields = ('voted_by', 'downvoted_by') diff --git a/helpdesk/migrations/0031_auto_20200225_1440.py b/helpdesk/migrations/0031_auto_20200225_1440.py new file mode 100644 index 00000000..c287f06f --- /dev/null +++ b/helpdesk/migrations/0031_auto_20200225_1440.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.10 on 2020-02-25 13:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('helpdesk', '0030_add_kbcategory_name'), + ] + + operations = [ + migrations.AlterModelOptions( + name='kbitem', + options={'ordering': ('order', 'title'), 'verbose_name': 'Knowledge base item', 'verbose_name_plural': 'Knowledge base items'}, + ), + migrations.AddField( + model_name='kbitem', + name='order', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Order'), + ), + ] diff --git a/helpdesk/models.py b/helpdesk/models.py index 409721f7..15465160 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1317,6 +1317,12 @@ class KBItem(models.Model): null=True, ) + order = models.PositiveIntegerField( + _('Order'), + blank=True, + null=True, + ) + def save(self, *args, **kwargs): if not self.last_updated: self.last_updated = timezone.now() @@ -1333,7 +1339,7 @@ class KBItem(models.Model): return '%s: %s' % (self.category.title, self.title) class Meta: - ordering = ('title',) + ordering = ('order', 'title',) verbose_name = _('Knowledge base item') verbose_name_plural = _('Knowledge base items')