From b23cf3adb85035a2de05f9cd1a50f1d6094eebae Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 30 Sep 2025 15:46:23 +0200 Subject: [PATCH] Add request_url field and otrs_link.js integration to service admins with ordered fields --- input/admin.py | 134 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 3 deletions(-) diff --git a/input/admin.py b/input/admin.py index 6c8b0a8..40500b6 100755 --- a/input/admin.py +++ b/input/admin.py @@ -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([