utils
main.utils
¤
General utilities for ProCAT.
Classes¤
Functions¤
create_HoRSE_group(*args)
¤
Create HoRSE group.
Source code in main/utils.py
58 59 60 | |
create_analysis(*args)
¤
Create default analysis codes.
Source code in main/utils.py
45 46 47 48 49 | |
destroy_HoRSE_group(*args)
¤
Delete HoRSE group.
Source code in main/utils.py
63 64 65 | |
destroy_analysis(*args)
¤
Delete default analysis codes.
Source code in main/utils.py
52 53 54 55 | |
format_currency(value)
¤
Format a float value as a GBP currency with two decimal places.
Source code in main/utils.py
243 244 245 | |
get_budget_status(date=None)
¤
Get the budget status of a funding.
Source code in main/utils.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
get_calendar_year_dates()
¤
Get the start and end dates for the current calendar year.
Source code in main/utils.py
223 224 225 226 227 228 | |
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
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
get_financial_year_dates()
¤
Get the start and end dates for the current financial year.
Source code in main/utils.py
231 232 233 234 235 236 237 238 239 240 | |
get_head_email()
¤
Get the emails of the HoRSE group users.
Source code in main/utils.py
115 116 117 118 119 120 121 | |
get_logged_hours(entries)
¤
Calculate total logged hours from time entries.
Source code in main/utils.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
get_month_dates_for_previous_years()
¤
Get the start and end date of each month for the previous 3 years.
Source code in main/utils.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
get_projects_with_days_used_exceeding_days_left()
¤
Get projects whose time entries exceed the total effort of the project.
Source code in main/utils.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
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
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |