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.

52 lines
1.7 KiB

6 years ago
6 years ago
  1. from django.contrib import admin
  2. from .models import Label, Document, Project
  3. from .models import DocumentAnnotation, SequenceAnnotation, Seq2seqAnnotation
  4. from .models import TextClassificationProject, SequenceLabelingProject, Seq2seqProject
  5. class LabelAdmin(admin.ModelAdmin):
  6. list_display = ('text', 'project', 'text_color', 'background_color')
  7. ordering = ('project',)
  8. search_fields = ('project',)
  9. class DocumentAdmin(admin.ModelAdmin):
  10. list_display = ('text', 'project', 'meta')
  11. ordering = ('project',)
  12. search_fields = ('project',)
  13. class ProjectAdmin(admin.ModelAdmin):
  14. list_display = ('name', 'description', 'project_type', 'randomize_document_order')
  15. ordering = ('project_type',)
  16. search_fields = ('name',)
  17. class SequenceAnnotationAdmin(admin.ModelAdmin):
  18. list_display = ('document', 'label', 'start_offset', 'user')
  19. ordering = ('document',)
  20. search_fields = ('document',)
  21. class DocumentAnnotationAdmin(admin.ModelAdmin):
  22. list_display = ('document', 'label', 'user')
  23. ordering = ('document',)
  24. search_fields = ('document',)
  25. class Seq2seqAnnotationAdmin(admin.ModelAdmin):
  26. list_display = ('document', 'text', 'user')
  27. ordering = ('document',)
  28. search_fields = ('document',)
  29. admin.site.register(DocumentAnnotation, DocumentAnnotationAdmin)
  30. admin.site.register(SequenceAnnotation, SequenceAnnotationAdmin)
  31. admin.site.register(Seq2seqAnnotation, Seq2seqAnnotationAdmin)
  32. admin.site.register(Label, LabelAdmin)
  33. admin.site.register(Document, DocumentAdmin)
  34. admin.site.register(Project, ProjectAdmin)
  35. admin.site.register(TextClassificationProject, ProjectAdmin)
  36. admin.site.register(SequenceLabelingProject, ProjectAdmin)
  37. admin.site.register(Seq2seqProject, ProjectAdmin)