Skip to content

admin

main.admin ¤

Admin module for the main app.

Classes¤

CapacityAdmin ¤

Bases: ModelAdmin

Admin class for the Capacity model.

DailyRateAdmin ¤

Bases: ModelAdmin

Admin class for the DailyRate model.

Adding a new entry here changes the default rate proposed for new Funding records going forward; it does not affect existing ones.

FundingAdmin ¤

Bases: ModelAdmin

Admin class for the Funding model.

MonthlyChargeAdmin ¤

Bases: ModelAdmin

Admin class for the MonthlyCharge model.

Methods:¤
confirm_charge(request, queryset) ¤

Update monthly charge status to 'Confirmed'.

Source code in main/admin.py
145
146
147
148
149
150
@admin.action(description="Confirm monthly charges")
def confirm_charge(
    self, request: HttpRequest, queryset: QuerySet[MonthlyCharge]
) -> None:
    """Update monthly charge status to 'Confirmed'."""
    queryset.update(status="Confirmed")

ProjectAdmin ¤

Bases: ModelAdmin

Admin class for the Project model.

TimeEntryAdmin ¤

Bases: ModelAdmin

Admin class for the TimeEntry model.

Methods:¤
get_urls() ¤

Get urls for this admin view.

Source code in main/admin.py
103
104
105
106
107
108
109
110
111
112
113
def get_urls(self) -> list[URLPattern]:
    """Get urls for this admin view."""
    urls = super().get_urls()
    custom_urls = [
        path(
            "sync_timesheets/",
            self.sync_time_entries_view,
            name="sync-timesheets",
        )
    ]
    return custom_urls + urls
sync_time_entries_view(request) ¤

Forces a synchronisation of timesheets.

Source code in main/admin.py
115
116
117
118
119
120
121
122
123
124
125
126
127
def sync_time_entries_view(self, request: HttpRequest) -> HttpResponse:
    """Forces a synchronisation of timesheets."""
    issues = sync_clockify_time_entries()
    issues = sync_kimai_time_entries() or issues
    if not issues:
        self.message_user(request, "Syncronysation completted successfully!")
    else:
        self.message_user(
            request,
            "Something went wrong with the synchronisation. Check the logs.",
            level=messages.ERROR,
        )
    return HttpResponseRedirect(reverse("admin:main_timeentry_changelist"))

Functions:¤