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.

67 lines
2.1 KiB

6 years ago
6 years ago
6 years ago
  1. from django.contrib import admin
  2. from .models import Label, Document, Project
  3. from .models import Role, RoleMapping
  4. from .models import DocumentAnnotation, SequenceAnnotation, Seq2seqAnnotation
  5. from .models import TextClassificationProject, SequenceLabelingProject, Seq2seqProject
  6. class LabelAdmin(admin.ModelAdmin):
  7. list_display = ('text', 'project', 'text_color', 'background_color')
  8. ordering = ('project',)
  9. search_fields = ('project',)
  10. class DocumentAdmin(admin.ModelAdmin):
  11. list_display = ('text', 'project', 'meta')
  12. ordering = ('project',)
  13. search_fields = ('project',)
  14. class ProjectAdmin(admin.ModelAdmin):
  15. list_display = ('name', 'description', 'project_type', 'randomize_document_order')
  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',)
  22. class DocumentAnnotationAdmin(admin.ModelAdmin):
  23. list_display = ('document', 'label', 'user')
  24. ordering = ('document',)
  25. search_fields = ('document',)
  26. class Seq2seqAnnotationAdmin(admin.ModelAdmin):
  27. list_display = ('document', 'text', 'user')
  28. ordering = ('document',)
  29. search_fields = ('document',)
  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',)
  38. admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin)
  39. admin.site.register(SequenceAnnotation, SequenceAnnotationAdmin)
  40. admin.site.register(Seq2seqAnnotation, Seq2seqAnnotationAdmin)
  41. admin.site.register(Label, LabelAdmin)
  42. admin.site.register(Document, DocumentAdmin)
  43. admin.site.register(Project, ProjectAdmin)
  44. admin.site.register(TextClassificationProject, ProjectAdmin)
  45. admin.site.register(SequenceLabelingProject, ProjectAdmin)
  46. admin.site.register(Seq2seqProject, ProjectAdmin)
  47. admin.site.register(Role, RoleAdmin)
  48. admin.site.register(RoleMapping, RoleMappingAdmin)