Django Library PaTT
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. from django.contrib import admin
  2. from .models import Project, Task, Comment, Search, PattUserProfile
  3. from simple_history.admin import SimpleHistoryAdmin
  4. class ProjectAdmin(admin.ModelAdmin):
  5. list_display = ('name', 'description', 'id', )
  6. search_fields = ('name', 'description', 'id', )
  7. list_filter = (
  8. ('state', admin.ChoicesFieldListFilter),
  9. ('role_leader', admin.RelatedFieldListFilter),
  10. ('role_member', admin.RelatedFieldListFilter),
  11. )
  12. class TaskAdmin(SimpleHistoryAdmin):
  13. list_display = ('name', 'description', 'id', )
  14. history_list_display = ('name', 'description', 'state', )
  15. search_fields = ('name', 'description', 'id', )
  16. list_filter = (
  17. ('state', admin.ChoicesFieldListFilter),
  18. ('priority', admin.ChoicesFieldListFilter),
  19. ('assigned_user', admin.RelatedFieldListFilter),
  20. ('project', admin.RelatedFieldListFilter),
  21. )
  22. class CommentAdmin(SimpleHistoryAdmin):
  23. list_display = ('task', 'user', 'type', 'comment', )
  24. history_list_display = ('comment', 'type', )
  25. search_fields = ('comment', )
  26. list_filter = (
  27. ('type', admin.ChoicesFieldListFilter),
  28. ('user', admin.RelatedFieldListFilter),
  29. )
  30. class ViewSettingAdmin(admin.ModelAdmin):
  31. list_display = ('profile', 'view', )
  32. search_fields = ('profile', 'view', )
  33. list_filter = (
  34. ('profile', admin.RelatedFieldListFilter),
  35. )
  36. class PattProfileAdmin(admin.ModelAdmin):
  37. list_display = ('user', )
  38. search_fields = ('user', )
  39. list_filter = (
  40. ('user', admin.RelatedFieldListFilter),
  41. )
  42. class SearchAdmin(admin.ModelAdmin):
  43. list_display = ('user', 'name', )
  44. search_fields = ('user', 'name', )
  45. list_filter = (
  46. ('user', admin.RelatedFieldListFilter),
  47. )
  48. class PattUserProfileAdmin(admin.ModelAdmin):
  49. list_display = ('user', 'threshold_very_soon', 'threshold_soon', )
  50. admin.site.register(Project, ProjectAdmin)
  51. admin.site.register(Task, TaskAdmin)
  52. admin.site.register(Comment, CommentAdmin)
  53. admin.site.register(Search, SearchAdmin)
  54. admin.site.register(PattUserProfile, PattUserProfileAdmin)