acp_calendar package¶
Subpackages¶
Submodules¶
acp_calendar.admin module¶
acp_calendar.app_settings module¶
acp_calendar.apps module¶
acp_calendar.exceptions module¶
acp_calendar.forms module¶
-
class
acp_calendar.forms.CalculatorForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form-
base_fields= OrderedDict([('start_date', <django.forms.fields.DateField object>), ('end_date', <django.forms.fields.DateField object>)])¶
-
declared_fields= OrderedDict([('start_date', <django.forms.fields.DateField object>), ('end_date', <django.forms.fields.DateField object>)])¶
-
media¶
-
acp_calendar.initial_data module¶
acp_calendar.managers module¶
acp_calendar.models module¶
-
class
acp_calendar.models.ACPHoliday(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelModel for a non working day in the Panama Canal due to a holiday. This model contains all the logic for the working days calculations.
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
static
convert_to_date(study_date)[source]¶ Converts String to date to a date object.
Parameters: study_date – date to be processed Returns: date object
-
date¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
static
days_in_range_generator(start_date, end_date)[source]¶ Creates a generator that contains all date dates between start_date and end_date
Parameters: - start_date – Start date in string or date
- end_date – End date in string or date
Returns: A generator containing all dates in range
-
fiscal_year¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_date(*moreargs, **morekwargs)¶
-
get_previous_by_date(*moreargs, **morekwargs)¶
-
static
get_working_days(start_date, end_date, **kwargs)[source]¶ Calculates the amount of working days between start date and end date. It will calculate all days that are not saturday or sunday and then substract the holiday in the range if they exist.
Parameters: - start_date –
- end_date –
- kwargs –
Returns: Number of working days between the star date and the end date
-
static
get_working_days_for_month(year, month)[source]¶ Calculate the amount of working days in a month
Parameters: - year – Year
- month – month
Returns: Number of working days
-
holiday_type¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parentis aForwardManyToOneDescriptorinstance.
-
holiday_type_id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects= <acp_calendar.managers.ACPHolidayManager object>¶
-
static
validate_dates(start_date, end_date)[source]¶ Validates three rules: 1. End date is not before start date 2. End date cannot occur after oldest holiday in database 3. Start date cannot occur before the first holiday in database
Will raise an ACPCalendarException if one of these rules is broken.
Parameters: - start_date – Start date
- end_date – End date
-
exception
-
class
acp_calendar.models.FiscalYear(year, **kwargs)[source]¶ Bases:
objectThis class represents a Pancama Canal Fiscal year which start on October first of the previous year and ends on September 30th of the current year. For example fiscal year 2016 starts on October 1st, 2015 and ends September 30th 2016
-
static
create_from_date(cdate, **kwargs)[source]¶ Creates a Fiscal year object for a date.
Parameters: - cdate – Date or datetime object within the fiscal year
- kwargs – Same kwargs as for the constructor
Returns: a FiscalYear object
-
static
-
class
acp_calendar.models.HolidayType(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelModel for Holiday type.
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
acpholiday_set¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
name¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects= <django.db.models.manager.Manager object>¶
-
short_name¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception