From ad3b5a88c87477f237a60040c5dc08e2ac90605a Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 1 Jul 2020 17:38:24 +0900 Subject: [PATCH] Fix error on Django Admin search, closes #859 --- app/api/admin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/api/admin.py b/app/api/admin.py index 5a3cf4ce..58ca2cc6 100644 --- a/app/api/admin.py +++ b/app/api/admin.py @@ -9,13 +9,13 @@ from .models import TextClassificationProject, SequenceLabelingProject, Seq2seqP class LabelAdmin(admin.ModelAdmin): list_display = ('text', 'project', 'text_color', 'background_color') ordering = ('project',) - search_fields = ('project',) + search_fields = ('text',) class DocumentAdmin(admin.ModelAdmin): list_display = ('text', 'project', 'meta') ordering = ('project',) - search_fields = ('project',) + search_fields = ('text',) class ProjectAdmin(admin.ModelAdmin): @@ -27,19 +27,19 @@ class ProjectAdmin(admin.ModelAdmin): class SequenceAnnotationAdmin(admin.ModelAdmin): list_display = ('document', 'label', 'start_offset', 'user') ordering = ('document',) - search_fields = ('document',) + search_fields = ('document__text',) class DocumentAnnotationAdmin(admin.ModelAdmin): list_display = ('document', 'label', 'user') ordering = ('document',) - search_fields = ('document',) + search_fields = ('document__text',) class Seq2seqAnnotationAdmin(admin.ModelAdmin): list_display = ('document', 'text', 'user') ordering = ('document',) - search_fields = ('document',) + search_fields = ('document__text',) class RoleAdmin(admin.ModelAdmin): @@ -51,7 +51,7 @@ class RoleAdmin(admin.ModelAdmin): class RoleMappingAdmin(admin.ModelAdmin): list_display = ('user', 'role', 'project', ) ordering = ('user',) - search_fields = ('user',) + search_fields = ('user__username',) admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin)