Browse Source

Merge pull request #863 from doccano/fix/issue859

Fix error on Django Admin search, closes #859
pull/864/head
Hiroki Nakayama 4 years ago
committed by GitHub
parent
commit
fd4dc57f92
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions
  1. 12
      app/api/admin.py

12
app/api/admin.py

@ -9,13 +9,13 @@ from .models import TextClassificationProject, SequenceLabelingProject, Seq2seqP
class LabelAdmin(admin.ModelAdmin): class LabelAdmin(admin.ModelAdmin):
list_display = ('text', 'project', 'text_color', 'background_color') list_display = ('text', 'project', 'text_color', 'background_color')
ordering = ('project',) ordering = ('project',)
search_fields = ('project',)
search_fields = ('text',)
class DocumentAdmin(admin.ModelAdmin): class DocumentAdmin(admin.ModelAdmin):
list_display = ('text', 'project', 'meta') list_display = ('text', 'project', 'meta')
ordering = ('project',) ordering = ('project',)
search_fields = ('project',)
search_fields = ('text',)
class ProjectAdmin(admin.ModelAdmin): class ProjectAdmin(admin.ModelAdmin):
@ -27,19 +27,19 @@ class ProjectAdmin(admin.ModelAdmin):
class SequenceAnnotationAdmin(admin.ModelAdmin): class SequenceAnnotationAdmin(admin.ModelAdmin):
list_display = ('document', 'label', 'start_offset', 'user') list_display = ('document', 'label', 'start_offset', 'user')
ordering = ('document',) ordering = ('document',)
search_fields = ('document',)
search_fields = ('document__text',)
class DocumentAnnotationAdmin(admin.ModelAdmin): class DocumentAnnotationAdmin(admin.ModelAdmin):
list_display = ('document', 'label', 'user') list_display = ('document', 'label', 'user')
ordering = ('document',) ordering = ('document',)
search_fields = ('document',)
search_fields = ('document__text',)
class Seq2seqAnnotationAdmin(admin.ModelAdmin): class Seq2seqAnnotationAdmin(admin.ModelAdmin):
list_display = ('document', 'text', 'user') list_display = ('document', 'text', 'user')
ordering = ('document',) ordering = ('document',)
search_fields = ('document',)
search_fields = ('document__text',)
class RoleAdmin(admin.ModelAdmin): class RoleAdmin(admin.ModelAdmin):
@ -51,7 +51,7 @@ class RoleAdmin(admin.ModelAdmin):
class RoleMappingAdmin(admin.ModelAdmin): class RoleMappingAdmin(admin.ModelAdmin):
list_display = ('user', 'role', 'project', ) list_display = ('user', 'role', 'project', )
ordering = ('user',) ordering = ('user',)
search_fields = ('user',)
search_fields = ('user__username',)
admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin) admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin)

Loading…
Cancel
Save