core Package

forms Module

class core.forms.BootstrapAuthenticationForm(*args, **kwargs)[source]

A login form using bootstrap attributes.

class core.forms.DateRangeForm(*args, **kwargs)[source]

A form for acquiring a DateRange via a start_date and enddate.

class core.forms.RequiredBaseFormSet(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>)[source]

A BaseFormSet that requires at least one filled form.

class core.forms.RequiredBaseInlineFormSet(data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs)[source]

A BaseInlineFormSet that requires at least one filled form.

class core.forms.RequiredFormSetMixin[source]

This class ensures at least one form in the formset is filled.

clean()[source]

Ensure that at least one filled form exists.

context_processors Module

core.context_processors.template_accessible_settings(request)[source]

Inject template-accessible settings into every context.

core Module

core.core.first_day_of_month()[source]

Return the first day of the current month in MM/DD/YYYY format.

core.core.first_day_of_year()[source]

Return the first day of the current year in MM/DD/YYYY format.

core.core.process_month_start_date_range_form(request)[source]

Returns a DateRangeForm, start_date and stop_date based on the request GET data. Defaults to using beginning of this month to today.

core.core.process_quick_search_form(get_dictionary, get_variable, form)[source]

Return a form and the id of the related model.

QuickSearchForms are Forms with a single Select input filled with model instances. Each Search submits with a different GET variable.

This function determines if the get_variable is in the request‘s GET data. If so, and the Form is valid, it will bind the form and return a tuple containing the bound form and the id of the selected object. Otherwise, the function will return tuple containing an unbound form and None.

For usage, see core.templatetags.core_tags().

Parameters:
  • get_dictionary – The request’s GET dictionary.
  • get_variable (str) – The GET variable to search the request for, it’s presence indicates form submission.
  • form (Form) – The form class to use.
Returns:

A tuple containing a bound or unbound Form and the objects id

Return type:

tuple

core.core.process_year_start_date_range_form(request)[source]

Returns a DateRangeForm, start_date and stop_date based on the request GET data. Defaults to using beginning of this year to today.

core.core.remove_trailing_zeroes(number)[source]

Reduce any trailing zeroes down to two decimal places.

Parameters:number (A number or string representing a number.) – The number to reduce.
Returns:The number with zeroes past the 2nd decimal place removed.
Return type:String
core.core.today_in_american_format()[source]

Return the Today’s Date in MM/DD/YYYY format.

middleware Module

class core.middleware.LoginRequiredMiddleware[source]

Add Ability to Hide All Pages From Unauthorized Users.

Checks the REQUIRE_LOGIN setting to see if the Middleware is enabled, and adds exceptions for any URL regexes defined in the REQUIRE_LOGIN_EXEMPT_URLS setting.

process_request(request)[source]

Redirect to Login Page if Enabled & User Unauthenticated.

views Module

Abstract views used throughout the application.

class core.views.AddApprovableEntryView[source]

A View for adding, editing, approving and deleting Approvable Entries

To use this view, subclass it and set the following class attributes:

  • entry_class - The class of the Approvable Entry
  • entry_form_class - The class of the Entry’s Form
  • transaction_formset_class - The class of the Entry’s Transaction’s FormSet
  • verbose_name - A user-friendly name for the Entry type
  • receipt_class - The class of the Entry’s Receipts
  • receipt_entry_field - The field to access an Entry from a Receipt
  • list_entries_view - The view used to list all Entries(a string of the module-dotted path for use with reverse, e.g. trips.views.list_trip_entries)
  • add_entry_view - The view used to add a new Entry
  • show_entry_view - The view used to show a single Entry.

The Entry must have the following methods defined:

  • entry.get_number() - Produces a journal number like XX#000123
  • entry.approve_entry() - Creates a JournalEntry, Transactions and Receipts from the Entry. Should not delete the Entry.
  • entry.get_next_entry() - Produces a Queryset of the Entries to fetch next, if any exist.

The following instance variables are set during request processing:

  • entry - The model instance being created/modified.
  • entry_form - The bound form
  • transaction_formset - The bound formset
render(request, entry_id, template_name)[source]

Use the specified class attributes to render the view.

core.views.list_entries(request, template_name, entry_class)[source]

Return a response for listing all specified Entries.

core.views.show_single_entry(request, entry_id, template_name, entry_class)[source]

View single Entry, specified by id and class.