You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.4 KiB

6 years ago
3 years ago
3 years ago
  1. from django.contrib import admin
  2. from .models import (Comment, Document, DocumentAnnotation, Label, Project,
  3. Role, RoleMapping, Seq2seqAnnotation, Seq2seqProject,
  4. SequenceAnnotation, SequenceLabelingProject,
  5. TextClassificationProject)
  6. class LabelAdmin(admin.ModelAdmin):
  7. list_display = ('text', 'project', 'text_color', 'background_color')
  8. ordering = ('project',)
  9. search_fields = ('text',)
  10. class DocumentAdmin(admin.ModelAdmin):
  11. list_display = ('text', 'project', 'meta')
  12. ordering = ('project',)
  13. search_fields = ('text',)
  14. class ProjectAdmin(admin.ModelAdmin):
  15. list_display = ('name', 'description', 'project_type', 'randomize_document_order', 'collaborative_annotation')
  16. ordering = ('project_type',)
  17. search_fields = ('name',)
  18. class SequenceAnnotationAdmin(admin.ModelAdmin):
  19. list_display = ('document', 'label', 'start_offset', 'user')
  20. ordering = ('document',)
  21. search_fields = ('document__text',)
  22. class DocumentAnnotationAdmin(admin.ModelAdmin):
  23. list_display = ('document', 'label', 'user')
  24. ordering = ('document',)
  25. search_fields = ('document__text',)
  26. class Seq2seqAnnotationAdmin(admin.ModelAdmin):
  27. list_display = ('document', 'text', 'user')
  28. ordering = ('document',)
  29. search_fields = ('document__text',)
  30. class RoleAdmin(admin.ModelAdmin):
  31. list_display = ('name', 'description')
  32. ordering = ('name',)
  33. search_fields = ('name',)
  34. class RoleMappingAdmin(admin.ModelAdmin):
  35. list_display = ('user', 'role', 'project', )
  36. ordering = ('user',)
  37. search_fields = ('user__username',)
  38. class CommentAdmin(admin.ModelAdmin):
  39. list_display = ('user', 'document', 'text', 'created_at', )
  40. ordering = ('user', 'created_at', )
  41. search_fields = ('user',)
  42. admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin)
  43. admin.site.register(SequenceAnnotation, SequenceAnnotationAdmin)
  44. admin.site.register(Seq2seqAnnotation, Seq2seqAnnotationAdmin)
  45. admin.site.register(Label, LabelAdmin)
  46. admin.site.register(Document, DocumentAdmin)
  47. admin.site.register(Project, ProjectAdmin)
  48. admin.site.register(TextClassificationProject, ProjectAdmin)
  49. admin.site.register(SequenceLabelingProject, ProjectAdmin)
  50. admin.site.register(Seq2seqProject, ProjectAdmin)
  51. admin.site.register(Role, RoleAdmin)
  52. admin.site.register(RoleMapping, RoleMappingAdmin)
  53. admin.site.register(Comment, CommentAdmin)