mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 15:33:09 +01:00
add KBitem.order to allow ordering items
This commit is contained in:
parent
5a594b7436
commit
d0aafd6135
@ -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')
|
||||
|
||||
|
22
helpdesk/migrations/0031_auto_20200225_1440.py
Normal file
22
helpdesk/migrations/0031_auto_20200225_1440.py
Normal file
@ -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'),
|
||||
),
|
||||
]
|
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user