Columns are added to the projects view in administration.

Column tasks_count is added.
pull/1331/head^2
Diego Acuña 2023-04-26 18:19:29 -04:00
rodzic ecd89a3f3f
commit 3429255f42
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -23,7 +23,14 @@ from webodm import settings
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):

Wyświetl plik

@ -48,6 +48,9 @@ class Project(models.Model):
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