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.

77 lines
2.3 KiB

6 years ago
3 years ago
3 years ago
3 years ago
  1. from django.contrib import admin
  2. from .models import (Category, Comment, Example, Label, Project, Role,
  3. RoleMapping, Seq2seqProject, SequenceLabelingProject,
  4. Span, 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 ExampleAdmin(admin.ModelAdmin):
  10. list_display = ('text', 'project', 'meta')
  11. ordering = ('project',)
  12. search_fields = ('text',)
  13. class ProjectAdmin(admin.ModelAdmin):
  14. list_display = ('name', 'description', 'project_type', 'random_order', 'collaborative_annotation')
  15. ordering = ('project_type',)
  16. search_fields = ('name',)
  17. class SpanAdmin(admin.ModelAdmin):
  18. list_display = ('example', 'label', 'start_offset', 'user')
  19. ordering = ('example',)
  20. class CategoryAdmin(admin.ModelAdmin):
  21. list_display = ('example', 'label', 'user')
  22. ordering = ('example',)
  23. class TextLabelAdmin(admin.ModelAdmin):
  24. list_display = ('example', 'text', 'user')
  25. ordering = ('example',)
  26. class RoleAdmin(admin.ModelAdmin):
  27. list_display = ('name', 'description')
  28. ordering = ('name',)
  29. search_fields = ('name',)
  30. class RoleMappingAdmin(admin.ModelAdmin):
  31. list_display = ('user', 'role', 'project', )
  32. ordering = ('user',)
  33. search_fields = ('user__username',)
  34. class TagAdmin(admin.ModelAdmin):
  35. list_display = ('project', 'text', )
  36. ordering = ('project', 'text', )
  37. search_fields = ('text',)
  38. class CommentAdmin(admin.ModelAdmin):
  39. list_display = ('user', 'example', 'text', 'created_at', )
  40. ordering = ('user', 'created_at', )
  41. search_fields = ('user',)
  42. admin.site.register(Category, CategoryAdmin)
  43. admin.site.register(Span, SpanAdmin)
  44. admin.site.register(TextLabel, TextLabelAdmin)
  45. admin.site.register(Label, LabelAdmin)
  46. admin.site.register(Example, ExampleAdmin)
  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)
  54. admin.site.register(Tag, TagAdmin)