Welcome to Ulimi Time Tracker’s documentation!

This is a complete list of functions and classes. automatically generated by sphinx. You can search by index or modules.

Indices and tables

class vms.views.ClientAdminInviteAcceptView(**kwargs)[source]

Accept in invitation to become an admin for a client.

form_class

alias of vms.forms.ClientAdminInviteAcceptForm

form_valid(form)[source]

Save the form and redirect the user to the detail page of the client that the created admin links to.

Args:
form:
The validated form instance to save.
Returns:
A redirect response sending the user to the detail view of the created admin’s client.
get_form_kwargs()[source]

Get additional keyword arguments for the form.

Returns:
The keyword arguments used to initialize the form.
class vms.views.ClientCreateView(**kwargs)[source]

Create a new client company.

form_class

alias of vms.forms.ClientCreateForm

form_valid(form)[source]

Save the form and redirect the user to the newly created client’s detail page.

Returns:
A redirect response sending the user to the detail page of the newly created client.
test_func()[source]

Ensure the requesting user is the administrator of a staffing agency.

Returns:
A boolean indicating if the user should be allowed to access the view.
class vms.views.ClientDetailView(**kwargs)[source]

Retrieve information about a specific client.

get_context_data(**kwargs)[source]

Get additional context to render the template with.

Args:
**kwargs:
Additional values to be passed to the template.
Returns:
A dictionary containing the context used to render the view’s template.
get_object(queryset=None)[source]

Get the client whose slug is specified in the URL.

Args:
queryset:
The queryset to choose a client from. If a queryset is not provided, all clients are searched.
Returns:
The client with the slug given in the URL.
class vms.views.ClientJobCreateView(**kwargs)[source]
form_class

alias of vms.forms.ClientJobCreate

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

class vms.views.ClientJobDetailView(**kwargs)[source]

View or update the details of a specific client job.

get_object(queryset=None)[source]

Get the job specified by the client and job present in the URL.

Args:
queryset:
An optional queryset to choose from. If no queryset is provided, all client jobs will be searched.
Returns:
The client job specified by the client and jobs slugs in the URL.
class vms.views.ClientJobListView[source]

List the jobs for a particular client.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context to render the template with.

Args:
object_list:
The list of client jobs rendered by the view.
**kwargs:
Additional context variables for the template.
Returns:
A dictionary containing the context used to render the view’s template.
get_queryset()[source]

Get the jobs for the specified client.

Returns:
The jobs owned by the client whose slug is given in the URL.
class vms.views.ClockInView(**kwargs)[source]

View for clocking in.

form_class

alias of vms.forms.ClockInForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

class vms.views.ClockOutView(**kwargs)[source]

View for clocking out.

form_class

alias of vms.forms.ClockOutForm

form_valid(form)[source]

Save the valid form instance.

Args:
form:
The valid form instance.
Returns:
A redirect response for the user.
get_form_kwargs()[source]

Add the employee as a parameter for the form.

Returns:
The kwargs to instantiate the form instance with.
class vms.views.DashboardView(**kwargs)[source]
class vms.views.EmployeeApplyView(**kwargs)[source]

Apply a staffing agency employee to a client company.

form_class

alias of vms.forms.EmployeeApplyForm

form_valid(form)[source]

Save the form and redirect back to the staffing agency detail view.

Args:
form:
The form to save.
Returns:
A response redirecting the user to the staffing agency’s detail view.
get_context_data(**kwargs)[source]

Get additional context used to render the view’s template.

Args:
**kwargs:
Returns:
A dictionary containing the context used to render the view’s template.
get_form_kwargs()[source]

Get the keyword arguments to initialize the form with.

Returns:
A dictionary containing the arguments to initialize the view’s form instance with.
class vms.views.EmployeeApproveView(**kwargs)[source]

Can link a supervisor to an approved employee.

form_class

alias of vms.forms.EmployeeApprovalForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

class vms.views.EmployeeDetailView(**kwargs)[source]

View the details of a single employee.

get_context_data(**kwargs)[source]

Add date context to the view.

Args:
**kwargs:
Keyword arguments to pass to the base method.
Returns:
A dictionary containing context used to render the view.
get_object(queryset=None)[source]

Get the employee using the parameters in the URL.

Args:
queryset:
The queryset to pull from. If not provided, all employees are searched.
Returns:
The employee with the ID and client slug specifieid in the URL.
class vms.views.PendingEmployeesView(**kwargs)[source]

Can see the list of pending employees that need to be approved or stopped

get_queryset()[source]

Get the jobs for the specified client.

Returns:
The jobs owned by the client whose slug is given in the URL.
class vms.views.StaffingAgencyDetailView(**kwargs)[source]

Retrieve information about a specific staffing agency.

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object(**kwargs)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

class vms.views.StaffingAgencyEmployeeApproveView(**kwargs)[source]

Approve an employee who has applied to a staffing agency.

form_class

alias of vms.forms.StaffingAgencyEmployeeApprovalForm

form_valid(form)[source]

Save the form and redirect the user.

Args:
form:
The form to save.
Returns:
A response redirecting the user. If a next parameter is provided in the URL, the user is redirected there. Otherwise they are redirected to the list of pending employees.
get_form_kwargs()[source]
Returns:
A dictionary containing the keyword arguments used to instantiate the view’s form class.
class vms.views.StaffingAgencyEmployeeCreateView(**kwargs)[source]

Apply as an employee to a staffing agency.

form_class

alias of vms.forms.StaffingAgencyEmployeeCreateForm

form_valid(form)[source]

Save the form and redirect the user.

Args:
form:
The form to save.
Returns:
A response redirecting the user to their dashboard.
get_form_kwargs()[source]

Get the keyword arguments used to instantiate the form.

Returns:
A dictionary containing the arguments used to instantiate an instance of the view’s form class.
class vms.views.StaffingAgencyEmployeeDetailView(**kwargs)[source]
get_context_data(**kwargs)[source]

Get context data to render the view’s template with.

Args:
**kwargs:
Returns:
A dictionary containing context to render the view’s template with.
get_object(*args, **kwargs)[source]
Returns:
The staffing agency employee whose ID is specified in the URL.
class vms.views.StaffingAgencyEmployeePendingListView(*args, **kwargs)[source]

List the pending employees for a staffing agency.

get_context_data(*args, **kwargs)[source]
Returns:
The context used to render the view’s template.
get_queryset()[source]
Returns:
A queryset containing the pending employees for the staffing agency whose slug is given in the URL.
class vms.views.TimeRecordApproveView(**kwargs)[source]

Approve a specific time record.

form_class

alias of vms.forms.TimeRecordApprovalForm

form_valid(form)[source]

Save the form and redirect back to the hours approval page.

Args:
form:
The valid form instance to save.
Returns:
A redirect response. If a ‘next’ parameter is provided in the URL, the user is taken to that URL. Otherwise they are taken to the list of unapproved hours for the client who owns the time record that was just approved.
get_form_kwargs()[source]

Add additional information required for our custom form.

Returns:
The keyword arguments used to construct the form.
class vms.views.UnapprovedTimeRecordListView(**kwargs)[source]

List all the unapproved time records for a specific client.

get_queryset()[source]

Get the list of unapproved hours for the client.

Returns:
A queryset containing the unapproved time records for the client specified in the URL.
class vms.models.Client(*args, **kwargs)[source]

A client is a company that employees perform work for.

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Generate a unique ID and slug if necessary.

get_absolute_url()[source]

Get the URL of the instance’s detail view.

Returns:
The absolute URL of the instance’s detail view.
job_list_url

Get the URL of the client’s job list.

Returns:
The URL of the view where all the client’s jobs are listed.
unapproved_time_record_list_url

Get the URL of the client’s unapproved time record list.

Returns:
The absolute URL of the view to list the client’s unapproved time records.
class vms.models.ClientAdmin(*args, **kwargs)[source]

A link between a user and a client that grants the linked user admin permissions on the associated client company.

exception DoesNotExist
exception MultipleObjectsReturned
class vms.models.ClientAdminInvite(*args, **kwargs)[source]

An invitation for a user to become a client admin.

exception DoesNotExist
exception MultipleObjectsReturned
accept(user)[source]

Accept the invitation.

Args:
user:
The user who accepted the invitation.
Returns:
The created client admin.
accept_url
Returns:
The absolute URL of the view to accept the invite.
send(request)[source]

Send an invitation message to the email address associated with the instance.

Args:
request:
The request that was made to trigger the send. This is used to build the full URL for accepting the invite.
class vms.models.ClientJob(*args, **kwargs)[source]

A type of task that can be worked on for a specific client.

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Generate a slug for the instance if necessary.

clean_fields(exclude=None)[source]

Ensure the name of the instance is not too similar to other jobs owned by the same client.

Args:
exclude:
An optional list of fields to exclude from validation. Defaults to None.
get_absolute_url()[source]

Get the absolute URL of the instance’s detail view.

Returns:
The absolute URL of the instance’s detail view.
class vms.models.Employee(*args, **kwargs)[source]

An employee working for a specific company.

exception DoesNotExist
exception MultipleObjectsReturned
approve(admin)[source]

Approve the employee’s request to join the client.

Args:
admin:
The client admin who approved the request.
approve_url
Returns:
The absolute URL of the view used to approve the employee.
clock_in_url
Returns:
The absolute URL of the view used to clock in the employee.
clock_out_url
Returns:
The absolute URL of the view used to clock out the employee.
get_absolute_url()[source]
Returns:
The URL of the view for an employee of a client
is_clocked_in

Determine if the employee is currently clocked in.

Returns:
A boolean indicating if the employee is clocked in.
save(*args, **kwargs)[source]

Save the employee and generate an ID for them if necessary.

total_time

Get the total time that the employee has logged.

Returns:
The total time the employee has worked, in seconds.
validate_unique(exclude=None)[source]

Validate that the employee’s ID is unique to the company they work for.

Args:
exclude:
An optional list of field names to exclude from the check.
class vms.models.StaffingAgency(*args, **kwargs)[source]

A company that provides employees to clients.

exception DoesNotExist
exception MultipleObjectsReturned
get_absolute_url()[source]
Returns:
The absolute URL of the instance’s detail view.
save(*args, **kwargs)[source]

Save the agency, creating a slug if necessary.

Args:
*args:
Positional arguments to pass to the original save method.
**kwargs:
Keyword arguments to pass to the original save method.
class vms.models.StaffingAgencyAdmin(*args, **kwargs)[source]

A link between a user and a staffing agency that grants the linked user admin permissions on the associated staffing agency.

exception DoesNotExist
exception MultipleObjectsReturned
class vms.models.StaffingAgencyEmployee(*args, **kwargs)[source]

An employee who is contracted out by a staffing agency.

exception DoesNotExist
exception MultipleObjectsReturned
approve(admin)[source]

Mark the staffing agency employee as approved.

Args:
admin:
The staffing agency administrator who approved the employee.
get_absolute_url()[source]

Get the URL of the staffing agency’s employee.

Returns:
The URL of the view where the staffing agency’s employee information is listed.
class vms.models.TimeRecord(*args, **kwargs)[source]

A record marking a work period for an employee.

exception DoesNotExist
exception MultipleObjectsReturned
approval_url

Get the URL of the view used to approve the time record.

Returns:
The absolute URL of the view used to approve the time record.
is_approved

Determine if the time record is approved.

Returns:
A boolean indicating if there is an approval record for the time record.
projected_earnings

Get the projected earning from this time record.

Returns:
The total time multiplied by the pay rate for this job.
total_time

Get the total time from this time record. Returns:

The time delta between start time and end time or delta of 0 if no end time.
class vms.models.TimeRecordApproval(*args, **kwargs)[source]

A record of the approval for a time record.

exception DoesNotExist
exception MultipleObjectsReturned
vms.models.generate_slug(value, queryset, slug_dest='slug')[source]

Generate and save a unique slug for the provided instance.

Args:
value:
The value to slugify.
queryset:
The queryset to search to ensure the generated slug is unique.
slug_dest:
The name of the attribute on the instance that the slug is saved to.
vms.models.generate_token()[source]

Generate a random token.

Returns:
A random 16-character alphanumeric string.
class vms.mixins.DateRangeMixin[source]

Mixin providing functionality for filtering by a date range.

The starting and ending times are specified as GET parameters.

end_date
Returns:

The end date provided in the URL. If both a start and end date are specified and the end date is prior to the start date, the start date is returned instead.

Note the end date is specified as a datetime so that we can include results for the entire day. This results in an inclusive bound which is more intuitive.

filter_by_date(queryset, start_attr='time_start', end_attr='time_end')[source]

Filter a queryset based on a date range.

If either bound is not provided, it is not restricted.

Args:
queryset:
The queryset to filter.
start_attr:
The attribute on the queryset that should be compared to the start time given in the URL.
end_attr:
The attribute on the queryset that should be compared to the end time given in the URL.
Returns:
The provided queryset filtered such that no record’s start_attr is before the start time in the URL and no record’s end_attr is after the end time in the URL.
get_context_data(**kwargs)[source]

Add date context to the view.

Args:
**kwargs:
Keyword arguments to pass to the base method.
Returns:
A dictionary containing context used to render the view.
start_date
Returns:
The start date provided in the URL as a datetime instance.
vms.time_utils.round_time_worked(time_worked, block_size=900)[source]

Round a period of time worked to the nearest block.

Typically this is used to round time worked to the closest 15 minute block.

Args:
time_worked:
The time period to round, in seconds.
block_size:
The block size to round to, in seconds. Defaults to 15 minutes.
Returns:
The time worked, in seconds, rounded to the nearest block.
class vms.managers.TimeRecordQuerySet(model=None, query=None, using=None, hints=None)[source]
total_time()[source]

Get the total duration of the time records in the queryset.

Returns:
The total duration of the time records in the queryset expressed as a datetime.timedelta instance.
with_deltas()[source]

Annotate the queryset to include a delta for each time record.

Because computing a delta relies on time_end being present, time records that have not been completed are excluded.

Returns:
A queryset annotated such that each time record has a delta attribute containing the delta between the record’s time_start and time_end.
vms.id_utils.generate_numeric_id(num_digits)[source]

Generate a numeric ID with the provided number of digits.

Args:
num_digits:
The number of digits present in the returned ID.
Returns:
A random ID with the specified number of digits.
vms.id_utils.generate_unique_id(digits, queryset, queryset_attr='id')[source]

Generate a unique ID for a given queryset.

The provided ID is guaranteed to be unique for the provided queryset.

warning ..

There is still a race condition between when the value is returned from the function and when it is saved to an instance.
Args:
digits:
The number of digits in the returned ID.
queryset:
The queryset used to check for uniqueness.
queryset_attr:
The attribute of the queryset to check for uniqueness. Defaults to id.
Returns:
A unique ID for the provided queryset of objects.
class vms.forms.ClientAdminInviteAcceptForm(token, *args, **kwargs)[source]

Form to accept an invitation to become a client admin.

clean()[source]

Ensure the provided token is valid.

save(user)[source]

Accept the invitation with the provided token.

Args:
user:
The user who is accepting the invitation.
Returns:
The newly created ClientAdmin instance.
class vms.forms.ClientCreateForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Form to create a new client.

Once the form is saved, a new client company is saved, and an email invitation to become an admin for the client is sent to the provided email address.

save(request=None, commit=True)[source]

Create a new client and send an email to the admin.

Args:
request:
The request made to trigger the form save.
commit:
A boolean indicating if the created model should be saved to the database or not.
Returns:
The created client instance.
class vms.forms.ClientJobCreate(client, *args, **kwargs)[source]

Form to create a new client job.

class vms.forms.ClockInForm(employee, *args, **kwargs)[source]

Form to clock in the requesting user.

clean()[source]

Validate the form to ensure the employee is not already clocked in.

save()[source]

Save the form to create a new time record.

class vms.forms.ClockOutForm(employee, *args, **kwargs)[source]

Form to clock out an employee.

clean()[source]

Validate the form’s data.

Raises:
forms.ValidationError:
If the employee is not clocked in.
save()[source]

Complete the employee’s open time record.

class vms.forms.EmployeeApplyForm(staffing_agency, user, *args, **kwargs)[source]

Form for applying an employee to a client company.

save(commit=True)[source]

Save the new employee and attach the fields provided when the form was created.

Args:
commit:
A boolean indicating if the created employee should be saved to the database. Defaults to True.
Returns:
The created employee.
class vms.forms.EmployeeApprovalForm(employee, *args, **kwargs)[source]

Form to link Employee to Supervisor

class vms.forms.StaffingAgencyEmployeeApprovalForm(employee, admin, *args, **kwargs)[source]

Form to approve a staff employee

clean()[source]

Ensure the employee and admin are associated with the same staffing agency.

Returns:
The cleaned data.
save()[source]

Approve the staffing agency employee associated with the form.

class vms.forms.StaffingAgencyEmployeeCreateForm(user, *args, **kwargs)[source]

Form to create a staffing agency employee.

save(user)[source]

Create a new staffing agency employee.

Args:
user:
The user to associate with the employee that is created.
Returns:
The newly created staffing agency employee.
class vms.forms.TimeRecordApprovalForm(time_record, approving_user, *args, **kwargs)[source]

Form to approve a time record.

save()[source]

Create an approval for the time record associated with the form.

Returns:
The approval instance created for the time record.
class vms.admin.ClientAdmin(model, admin_site)[source]
class vms.admin.ClientAdminAdmin(model, admin_site)[source]
class vms.admin.ClientAdminInviteAdmin(model, admin_site)[source]
class vms.admin.ClientJobAdmin(model, admin_site)[source]
class vms.admin.EmployeeAdmin(model, admin_site)[source]
supervisor_name(obj)[source]

Get the name of the employee’s supervisor.

Args:
obj:
The employee to get the supervisor of.
Returns:
The name of the employee’s supervisor if they have an assigned supervisor. Otherwise, a placeholder empty value is returned.
class vms.admin.StaffingAgencyAdmin(model, admin_site)[source]
class vms.admin.StaffingAgencyAdminAdmin(model, admin_site)[source]
class vms.admin.StaffingAgencyEmployeeAdmin(model, admin_site)[source]
class vms.admin.TimeRecordAdmin(model, admin_site)[source]
class vms.admin.TimeRecordApprovalAdmin(model, admin_site)[source]
vms.api.dialogflow.clock_in(client_id, employee_id, project_id=None)[source]

Clock in an employee.

Args:
client_id:
The ID of the client the employee works for.
employee_id:
The ID of the employee who is clocking in.
project_id:
The ID of the project the employee is working on.
Returns:
A response indicating the result of the clock in request.
vms.api.dialogflow.clock_out(client_id, employee_id)[source]

Clock out the employee with the provided information.

Args:
client_id:
The ID of the client that the employee who is clocking out works for.
employee_id:
The ID of the employee to clock out.
Returns:
A string describing the result of the clock out request.
vms.api.dialogflow.list_projects(client_id)[source]

Enumerate the projects for a client.

Args:
client_id:
The ID of the client company whose projects should be listed.
Returns:
A string message enumerating the projects.
vms.api.dialogflow.process(data)[source]

Fulfill a webhook request from Dialogflow.

Args:
data:
The data received from Dialogflow.
Returns:
A dictionary containing the data to return to Dialogflow.
class vms.api.serializers.DialogflowWebhookSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Serializer to handle a request from Dialogflow.

class vms.api.serializers.IntentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Serializer to handle information about the intent triggered by Dialogflow.

class vms.api.serializers.QuerySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Serializer to handle the query parameters for a Dialogflow fulfillment request.

class vms.api.views.DialogflowFulfillmentView(**kwargs)[source]
serializer_class

alias of vms.api.serializers.DialogflowWebhookSerializer

class account.admin.UserAdmin(model, admin_site)[source]
class account.forms.SignUpForm(*args, **kwargs)[source]
class account.managers.UserManager[source]

Manager object for custom user class.

create_superuser(*args, **kwargs)[source]

Create a user with superuser privileges.

Args:
*args:
The positional args to pass to create_user.
**kwargs:
The keyword args to pass to create_user.
Returns:
The new user instance.
create_user(name, username, password=None, **kwargs)[source]

Create a new user.

Args:
name:
The user’s full name.
username:
The user’s username.
password:
The user’s password.
**kwargs:
Additional keyword arguments to pass to the model instance.
Returns:
The new user instance.
class account.middleware.TimezoneMiddleware(get_response)[source]

Class to set the timezone for each request.

class account.models.User(*args, **kwargs)[source]

A single user.

exception DoesNotExist
exception MultipleObjectsReturned
class account.views.ProfileView(**kwargs)[source]

View the authenticated user’s profile.

class account.views.SignUpView(**kwargs)[source]

View to register new users.

form_class

alias of account.forms.SignUpForm

form_valid(form)[source]

Save the signup form and log in the created user.

Args:
form:
The form containing the data sent to the view.
Returns:
A redirect response sending the new user to their profile page.
get_success_url()[source]

Get the URL that the user is redirected to after submitting the form.

Returns:
The URL provided in the ‘next’ parameter or the URL of the user’s profile if no redirect URL is provided.