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
614 615 616 | |
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 |
|---|---|
float
|
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.
Funding left is calculated based on 'Confirmed' monthly charges.
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
|
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
469 470 471 | |
clean()
¤
Ensure that the activity code has a valid value.
Source code in main/models.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
is_complete()
¤
Checks if funding record is complete.
This is only relevant to funding where source is external.
Source code in main/models.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
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
676 677 678 | |
clean()
¤
Ensure the charge has valid funding attached and description if Manual.
Source code in main/models.py
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | |
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 |
|---|---|
float | None
|
The total number of days effort, or None if there is no funding information. |
total_funding_left
property
¤
Provide the total funding left after deducting confirmed charges.
Returns:
| Type | Description |
|---|---|
Decimal | None
|
The total monetary amount of funding left, or none if there is no funding |
Decimal | None
|
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 Tentative or Not done. |
Functions¤
__str__()
¤
String representation of the Project object.
Source code in main/models.py
191 192 193 | |
check_and_notify_status()
¤
Check the project status and notify accordingly.
Source code in main/models.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
clean()
¤
Ensure all fields have a value unless status is 'Tentative' or 'Not done'.
It also checks that, if present, the end date is after the start date.
Source code in main/models.py
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 221 | |
TimeEntry
¤
Bases: Model
Time entry for a user.
User
¤
Bases: AbstractUser
Custom user model.