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.

72 lines
2.1 KiB

6 years ago
3 years ago
3 years ago
3 years ago
  1. from django.contrib import admin
  2. from .models import (Category, CategoryType, Comment, Example, Project,
  3. Seq2seqProject, SequenceLabelingProject, Span, SpanType,
  4. Tag, TextClassificationProject, TextLabel)
  5. class LabelAdmin(admin.ModelAdmin):
  6. list_display = ('text', 'project', 'text_color', 'background_color')
  7. ordering = ('project',)
  8. search_fields = ('text',)
  9. class CategoryTypeAdmin(LabelAdmin):
  10. pass
  11. class SpanTypeAdmin(LabelAdmin):
  12. pass
  13. class ExampleAdmin(admin.ModelAdmin):
  14. list_display = ('text', 'project', 'meta')
  15. ordering = ('project',)
  16. search_fields = ('text',)
  17. class ProjectAdmin(admin.ModelAdmin):
  18. list_display = ('name', 'description', 'project_type', 'random_order', 'collaborative_annotation')
  19. ordering = ('project_type',)
  20. search_fields = ('name',)
  21. class SpanAdmin(admin.ModelAdmin):
  22. list_display = ('example', 'label', 'start_offset', 'user')
  23. ordering = ('example',)
  24. class CategoryAdmin(admin.ModelAdmin):
  25. list_display = ('example', 'label', 'user')
  26. ordering = ('example',)
  27. class TextLabelAdmin(admin.ModelAdmin):
  28. list_display = ('example', 'text', 'user')
  29. ordering = ('example',)
  30. class TagAdmin(admin.ModelAdmin):
  31. list_display = ('project', 'text', )
  32. ordering = ('project', 'text', )
  33. search_fields = ('text',)
  34. class CommentAdmin(admin.ModelAdmin):
  35. list_display = ('user', 'example', 'text', 'created_at', )
  36. ordering = ('user', 'created_at', )
  37. search_fields = ('user',)
  38. admin.site.register(Category, CategoryAdmin)
  39. admin.site.register(Span, SpanAdmin)
  40. admin.site.register(TextLabel, TextLabelAdmin)
  41. admin.site.register(CategoryType, CategoryTypeAdmin)
  42. admin.site.register(SpanType, SpanTypeAdmin)
  43. admin.site.register(Example, ExampleAdmin)
  44. admin.site.register(Project, ProjectAdmin)
  45. admin.site.register(TextClassificationProject, ProjectAdmin)
  46. admin.site.register(SequenceLabelingProject, ProjectAdmin)
  47. admin.site.register(Seq2seqProject, ProjectAdmin)
  48. admin.site.register(Comment, CommentAdmin)
  49. admin.site.register(Tag, TagAdmin)