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.
context_processors Module¶
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:
- 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.
middleware Module¶
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