utils
main.utils
¤
General utilities for ProCAT.
Classes¤
Functions¤
create_HoRSE_group(*args)
¤
Create HoRSE group.
Source code in main/utils.py
56 57 58 |
|
create_analysis(*args)
¤
Create default analysis codes.
Source code in main/utils.py
43 44 45 46 47 |
|
destroy_HoRSE_group(*args)
¤
Delete HoRSE group.
Source code in main/utils.py
61 62 63 |
|
destroy_analysis(*args)
¤
Delete default analysis codes.
Source code in main/utils.py
50 51 52 53 |
|
get_budget_status(date=None)
¤
Get the budget status of a funding.
Source code in main/utils.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
get_current_and_last_month(date=None)
¤
Get the start of the last month and current month, and their names.
Source code in main/utils.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
get_head_email()
¤
Get the emails of the HoRSE group users.
Source code in main/utils.py
113 114 115 116 117 118 119 |
|
get_logged_hours(entries)
¤
Calculate total logged hours from time entries.
Source code in main/utils.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
get_month_dates_for_previous_year()
¤
Get the start and end date of each month for the previous year.
Source code in main/utils.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
get_projects_with_days_used_exceeding_days_left(date=None)
¤
Get projects whose days used in the last month exceed the days left.
Source code in main/utils.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
order_queryset_by_property(queryset, property, is_descending)
¤
Orders a queryset according to a specified Model property.
Creates a Django conditional expression to assign the position of the model in a queryset according to its model ID (using a custom ordering). The conditional expression is then provided to the QuerySet.order_by() function. This can be used to update the ordering of a queryset column in a Table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
queryset
|
QuerySet[Any]
|
a model queryset for ordering |
required |
property
|
str
|
the name of the model property with which to order the queryset |
required |
is_descending
|
bool
|
bool to indicate whether the property should be sorted by descending (or ascending) order |
required |
Returns:
Type | Description |
---|---|
QuerySet[Any]
|
The queryset ordered according to the property. |
Source code in main/utils.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|