diff --git a/app/admin.py b/app/admin.py index 029dd3cb6..81848e199 100644 --- a/app/admin.py +++ b/app/admin.py @@ -23,7 +23,14 @@ from django.core.files.uploadedfile import InMemoryUploadedFile from django.utils.translation import gettext_lazy as _, gettext -admin.site.register(Project, GuardedModelAdmin) + +class ProjectAdmin(GuardedModelAdmin): + list_display = ('id', 'name', 'owner', 'created_at', 'tasks_count', 'tags') + list_filter = ('owner',) + search_fields = ('id', 'name', 'owner__username') + + +admin.site.register(Project, ProjectAdmin) class TaskAdmin(admin.ModelAdmin): diff --git a/app/models/project.py b/app/models/project.py index dc532da25..26b0a36a3 100644 --- a/app/models/project.py +++ b/app/models/project.py @@ -48,6 +48,9 @@ def __str__(self): def tasks(self): return self.task_set.only('id') + def tasks_count(self): + return self.task_set.count() + def get_map_items(self): return [task.get_map_items() for task in self.task_set.filter( status=status_codes.COMPLETED