patt/admin.py

71 rader
2.1 KiB
Python

from django.contrib import admin
from .models import Project, Task, Comment, Search, PattUserProfile
from simple_history.admin import SimpleHistoryAdmin
class ProjectAdmin(admin.ModelAdmin):
list_display = ('name', 'description', 'id', )
search_fields = ('name', 'description', 'id', )
list_filter = (
('state', admin.ChoicesFieldListFilter),
('role_leader', admin.RelatedFieldListFilter),
('role_member', admin.RelatedFieldListFilter),
)
class TaskAdmin(SimpleHistoryAdmin):
list_display = ('name', 'description', 'id', )
history_list_display = ('name', 'description', 'state', )
search_fields = ('name', 'description', 'id', )
list_filter = (
('state', admin.ChoicesFieldListFilter),
('priority', admin.ChoicesFieldListFilter),
('assigned_user', admin.RelatedFieldListFilter),
('project', admin.RelatedFieldListFilter),
)
class CommentAdmin(SimpleHistoryAdmin):
list_display = ('task', 'user', 'type', 'comment', )
history_list_display = ('comment', 'type', )
search_fields = ('comment', )
list_filter = (
('type', admin.ChoicesFieldListFilter),
('user', admin.RelatedFieldListFilter),
)
class ViewSettingAdmin(admin.ModelAdmin):
list_display = ('profile', 'view', )
search_fields = ('profile', 'view', )
list_filter = (
('profile', admin.RelatedFieldListFilter),
)
class PattProfileAdmin(admin.ModelAdmin):
list_display = ('user', )
search_fields = ('user', )
list_filter = (
('user', admin.RelatedFieldListFilter),
)
class SearchAdmin(admin.ModelAdmin):
list_display = ('user', 'name', )
search_fields = ('user', 'name', )
list_filter = (
('user', admin.RelatedFieldListFilter),
)
class PattUserProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'threshold_very_soon', 'threshold_soon', )
admin.site.register(Project, ProjectAdmin)
admin.site.register(Task, TaskAdmin)
admin.site.register(Comment, CommentAdmin)
admin.site.register(Search, SearchAdmin)
admin.site.register(PattUserProfile, PattUserProfileAdmin)