[UPDT] PROJECT: Updated timesheet list view description column
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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.
|
||||
|
||||
1
project/templates/cbv/timesheet/description_col.html
Normal file
1
project/templates/cbv/timesheet/description_col.html
Normal file
@@ -0,0 +1 @@
|
||||
{{instance.description|truncatechars_html:75}}
|
||||
Reference in New Issue
Block a user