diff --git a/project/cbv/timesheet.py b/project/cbv/timesheet.py index cf390b47b..3c689a1bc 100644 --- a/project/cbv/timesheet.py +++ b/project/cbv/timesheet.py @@ -151,22 +151,15 @@ class TimeSheetList(HorillaListView): self.search_url = reverse("time-sheet-list") self.action_method = "actions" - @cached_property - def columns(self): - get_field = self.model()._meta.get_field - return [ - ( - get_field("employee_id").verbose_name, - "employee_id", - "employee_id__get_avatar", - ), - (get_field("project_id").verbose_name, "project_id"), - (get_field("task_id").verbose_name, "task_id"), - (get_field("date").verbose_name, "date"), - (get_field("time_spent").verbose_name, "time_spent"), - (get_field("status").verbose_name, "get_status_display"), - (get_field("description").verbose_name, "description"), - ] + columns = [ + (_("Employee"), "employee_id", "employee_id__get_avatar"), + "project_id", + "task_id", + "date", + "time_spent", + "status", + (_("Description"), "get_description_col"), + ] @cached_property def sortby_mapping(self): diff --git a/project/models.py b/project/models.py index f01820a93..e4df24fec 100644 --- a/project/models.py +++ b/project/models.py @@ -609,6 +609,16 @@ class TimeSheet(HorillaModel): context={"instance": self}, ) + def get_description_col(self): + """ + This method for get custom column for action. + """ + + return render_template( + path="cbv/timesheet/description_col.html", + context={"instance": self}, + ) + def detail_actions(self): """ This method for get custom column for action. diff --git a/project/templates/cbv/timesheet/description_col.html b/project/templates/cbv/timesheet/description_col.html new file mode 100644 index 000000000..55b0679b0 --- /dev/null +++ b/project/templates/cbv/timesheet/description_col.html @@ -0,0 +1 @@ +{{instance.description|truncatechars_html:75}} \ No newline at end of file