forked from extern/django-helpdesk
removing QueueMembership mechanisms from admin.py
This commit is contained in:
parent
c1fd47043a
commit
230d14b3ca
@ -1,12 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
from django.contrib.auth.admin import UserAdmin
|
|
||||||
from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply, KBCategory
|
from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply, KBCategory
|
||||||
from helpdesk.models import EscalationExclusion, EmailTemplate, KBItem
|
from helpdesk.models import EscalationExclusion, EmailTemplate, KBItem
|
||||||
from helpdesk.models import TicketChange, Attachment, IgnoreEmail
|
from helpdesk.models import TicketChange, Attachment, IgnoreEmail
|
||||||
from helpdesk.models import CustomField
|
from helpdesk.models import CustomField
|
||||||
from helpdesk.models import QueueMembership
|
|
||||||
from helpdesk import settings as helpdesk_settings
|
|
||||||
|
|
||||||
class QueueAdmin(admin.ModelAdmin):
|
class QueueAdmin(admin.ModelAdmin):
|
||||||
list_display = ('title', 'slug', 'email_address', 'locale')
|
list_display = ('title', 'slug', 'email_address', 'locale')
|
||||||
@ -36,17 +32,6 @@ class EmailTemplateAdmin(admin.ModelAdmin):
|
|||||||
list_display = ('template_name', 'heading', 'locale')
|
list_display = ('template_name', 'heading', 'locale')
|
||||||
list_filter = ('locale', )
|
list_filter = ('locale', )
|
||||||
|
|
||||||
class QueueMembershipInline(admin.StackedInline):
|
|
||||||
model = QueueMembership
|
|
||||||
|
|
||||||
class UserAdminWithQueueMemberships(UserAdmin):
|
|
||||||
|
|
||||||
def change_view(self, request, object_id, form_url='', extra_context=None):
|
|
||||||
self.inlines = (QueueMembershipInline,)
|
|
||||||
|
|
||||||
return super(UserAdminWithQueueMemberships, self).change_view(
|
|
||||||
request, object_id, form_url=form_url, extra_context=extra_context)
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Ticket, TicketAdmin)
|
admin.site.register(Ticket, TicketAdmin)
|
||||||
admin.site.register(Queue, QueueAdmin)
|
admin.site.register(Queue, QueueAdmin)
|
||||||
@ -58,6 +43,3 @@ admin.site.register(KBCategory)
|
|||||||
admin.site.register(KBItem, KBItemAdmin)
|
admin.site.register(KBItem, KBItemAdmin)
|
||||||
admin.site.register(IgnoreEmail)
|
admin.site.register(IgnoreEmail)
|
||||||
admin.site.register(CustomField, CustomFieldAdmin)
|
admin.site.register(CustomField, CustomFieldAdmin)
|
||||||
if helpdesk_settings.HELPDESK_ENABLE_PER_QUEUE_STAFF_MEMBERSHIP:
|
|
||||||
admin.site.unregister(get_user_model())
|
|
||||||
admin.site.register(get_user_model(), UserAdminWithQueueMemberships)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user