mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 09:23:39 +01:00
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
from django.contrib import admin
|
|
from django.utils.translation import ugettext_lazy as _
|
|
from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply, KBCategory
|
|
from helpdesk.models import EscalationExclusion, EmailTemplate, KBItem
|
|
from helpdesk.models import TicketChange, Attachment, IgnoreEmail
|
|
from helpdesk.models import CustomField
|
|
|
|
|
|
@admin.register(Queue)
|
|
class QueueAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'slug', 'email_address', 'locale')
|
|
prepopulated_fields = {"slug": ("title",)}
|
|
|
|
|
|
@admin.register(Ticket)
|
|
class TicketAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'status', 'assigned_to', 'queue', 'hidden_submitter_email',)
|
|
date_hierarchy = 'created'
|
|
list_filter = ('queue', 'assigned_to', 'status')
|
|
|
|
def hidden_submitter_email(self, ticket):
|
|
if ticket.submitter_email:
|
|
username, domain = ticket.submitter_email.split("@")
|
|
username = username[:2] + "*" * (len(username) - 2)
|
|
domain = domain[:1] + "*" * (len(domain) - 2) + domain[-1:]
|
|
return "%s@%s" % (username, domain)
|
|
else:
|
|
return ticket.submitter_email
|
|
hidden_submitter_email.short_description = _('Submitter E-Mail')
|
|
|
|
|
|
class TicketChangeInline(admin.StackedInline):
|
|
model = TicketChange
|
|
|
|
|
|
class AttachmentInline(admin.StackedInline):
|
|
model = Attachment
|
|
|
|
|
|
@admin.register(FollowUp)
|
|
class FollowUpAdmin(admin.ModelAdmin):
|
|
inlines = [TicketChangeInline, AttachmentInline]
|
|
|
|
|
|
@admin.register(KBItem)
|
|
class KBItemAdmin(admin.ModelAdmin):
|
|
list_display = ('category', 'title', 'last_updated',)
|
|
list_display_links = ('title',)
|
|
|
|
|
|
@admin.register(CustomField)
|
|
class CustomFieldAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'label', 'data_type')
|
|
|
|
|
|
@admin.register(EmailTemplate)
|
|
class EmailTemplateAdmin(admin.ModelAdmin):
|
|
list_display = ('template_name', 'heading', 'locale')
|
|
list_filter = ('locale', )
|
|
|
|
|
|
admin.site.register(PreSetReply)
|
|
admin.site.register(EscalationExclusion)
|
|
admin.site.register(KBCategory)
|
|
admin.site.register(IgnoreEmail)
|