Add request_url field and otrs_link.js integration to service admins with ordered fields

This commit is contained in:
Roman 2025-09-30 15:46:23 +02:00
parent 0db5cb7fd9
commit b23cf3adb8
1 changed files with 131 additions and 3 deletions

View File

@ -52,7 +52,6 @@ class ProjectAdmin(admin.ModelAdmin):
js = ('dropdown/js/otrs_link.js',)
@admin.register(BusinessCard)
class BusinessCardAdmin(admin.ModelAdmin):
save_as = True
@ -62,8 +61,31 @@ class BusinessCardAdmin(admin.ModelAdmin):
# action = ['export_as_csv']
date_hierarchy = 'granted_date'
readonly_fields = ['service_id']
fields = [
'terms_accepted',
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'project',
'data',
'variant',
'url_of_pic',
'sent_to',
'send_data_to_print',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/base.js',)
js = ('dropdown/js/base.js', 'dropdown/js/otrs_link.js')
@admin.register(Literature)
class LiteratureAdmin(admin.ModelAdmin):
@ -74,6 +96,31 @@ class LiteratureAdmin(admin.ModelAdmin):
date_hierarchy = 'granted_date'
readonly_fields = ['service_id']
fields = [
'terms_accepted',
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'cost',
'notes',
'info',
'source',
'selfbuy',
'selfbuy_give_data',
'selfbuy_data',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/otrs_link.js',)
@admin.register(Account)
class AccountAdmin(admin.ModelAdmin):
@ -101,6 +148,27 @@ class LibraryAdmin(admin.ModelAdmin):
readonly_fields = ['service_id']
exclude = ['type']
fields = [
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'cost',
'notes',
'library',
'duration',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/otrs_link.js',)
def get_queryset(self, request):
return super().get_queryset(request).filter(type=self.model.TYPE)
@ -124,6 +192,26 @@ class IFGAdmin(admin.ModelAdmin):
date_hierarchy = 'granted_date'
readonly_fields = ['service_id']
fields = [
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'cost',
'notes',
'url',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/otrs_link.js',)
@admin.register(Travel)
class TravelAdmin(admin.ModelAdmin):
save_as = True
@ -147,8 +235,28 @@ class EmailAdmin(admin.ModelAdmin):
date_hierarchy = 'granted_date'
radio_fields = {'adult': admin.VERTICAL}
readonly_fields = ['service_id']
fields = [
'terms_accepted',
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'domain',
'address',
'other',
'adult',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/base.js',)
js = ('dropdown/js/base.js', 'dropdown/js/otrs_link.js')
@admin.register(List)
@ -160,6 +268,26 @@ class ListAdmin(admin.ModelAdmin):
date_hierarchy = 'granted_date'
readonly_fields = ['service_id']
fields = [
'terms_accepted',
'realname',
'email',
'granted',
'granted_date',
'survey_mail_date',
'mail_state',
'survey_mail_send',
'username',
'domain',
'address',
'request_url',
'intern_notes',
'service_id',
]
class Media:
js = ('dropdown/js/otrs_link.js',)
# commented out because of the individual registering to control displays in admin panel
#admin.site.register([