models
main.models
¤
Models module for main app.
Classes¤
AnalysisCode
¤
Capacity
¤
Bases: Model
Proportion of working time that team members are able to work on projects.
Classes¤
Meta
¤
Meta class for the model.
Functions¤
__str__()
¤
String representation of the Capacity object.
Source code in main/models.py
571 572 573 |
|
Department
¤
Bases: Model
Model to manage the departments.
You can find the faculties and potential departments in:
https://www.imperial.ac.uk/faculties-and-departments/
Funding
¤
Bases: Model
Funding associated with a project.
Attributes¤
effort
property
¤
Provide the effort in days, calculated based on the budget and daily rate.
Returns:
Type | Description |
---|---|
int
|
The total number of days of effort provided by the funding. |
effort_left
property
¤
Provide the effort left in days.
Returns:
Type | Description |
---|---|
float
|
The number of days worth of effort left. |
funding_left
property
¤
Provide the funding left in currency.
Returns:
Type | Description |
---|---|
Decimal
|
The amount of funding left. |
monthly_pro_rata_charge
property
¤
Calculate the charge per month if the project has Pro-rata charging.
Calculates the number of months between project start and end date regardless of the day of the month so the monthly charge will be the same regardless of the number of days in the month.
project_code
property
¤
Provide the project code, containing the cost centre and activity code.
Returns:
Type | Description |
---|---|
str | None
|
The designated project code. |
Classes¤
Meta
¤
Meta class for the model.
Functions¤
__str__()
¤
String representation of the Funding object.
Source code in main/models.py
439 440 441 |
|
clean()
¤
Ensure that all fields have a value unless the source is 'Internal'.
Source code in main/models.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
|
MonthlyCharge
¤
Bases: Model
Monthly charge for a specific project, account and analysis code.
Functions¤
__str__()
¤
String representation of the MonthlyCharge object.
Source code in main/models.py
620 621 622 |
|
clean()
¤
Ensure the charge has valid funding attached and description if Manual.
Source code in main/models.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
|
Project
¤
Bases: Model
Software project details.
Attributes¤
days_left
property
¤
Provide the days worth of effort left.
Returns:
Type | Description |
---|---|
tuple[float, float] | None
|
The number of days and percentage worth of effort left, or None if there is |
tuple[float, float] | None
|
no funding information. |
effort_per_day
property
¤
Calculate the estimated effort per day.
Considers only working (business) days.
Returns:
Type | Description |
---|---|
float | None
|
Float representing the estimated effort per day over project lifespan. |
percent_effort_left
property
¤
Provide the percentage of effort left.
Returns:
Type | Description |
---|---|
float | None
|
The percentage of effort left, or None if there is no funding information. |
total_effort
property
¤
Provide the total days worth of effort available from funding.
Returns:
Type | Description |
---|---|
int | None
|
The total number of days effort, or None if there is no funding information. |
total_working_days
property
¤
Provide the total number of working (business) days given the dates.
Returns:
Type | Description |
---|---|
int | None
|
Number of working days between the project start and end date. |
weeks_to_deadline
property
¤
Provide the number of weeks left until project deadline.
Only relevant for active projects.
Returns:
Type | Description |
---|---|
tuple[int, float] | None
|
The number of weeks left or None if the project is not Active. |
Functions¤
__str__()
¤
String representation of the Project object.
Source code in main/models.py
186 187 188 |
|
check_and_notify_status()
¤
Check the project status and notify accordingly.
Source code in main/models.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
clean()
¤
Ensure that all fields have a value unless the status is 'Draft'.
It also checks that, if present, the end date is after the start date.
Source code in main/models.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
TimeEntry
¤
Bases: Model
Time entry for a user.
User
¤
Bases: AbstractUser
Custom user model.