Bases: object
Adds schedule info to the mixed in class.
Adds schedule information like start_date, due_date and duration. There are theree parameters to initialize a class with ScheduleMixin, which are, start_date, due_date and duration. Only two of them are enough to initialize the class. The preceeding order for the parameters is as follows:
start_date > due_date > duration
So if all of the parameters are given only the start_date and the due_date will be used and the duration will be calculated accordingly. In any other conditions the missing parameter will be calculated from the following table:
start_date | due_date | duration | DEFAULTS |
---|---|---|---|
start_date = datetime.date.today() duration = datetime.timedelta(days=10) due_date = start_date + duration |
|||
X | duration = datetime.timedelta(days=10) due_date = start_date + duration |
||
X | X | duration = due_date - start_date | |
X | X | due_date = start_date + duration | |
X | X | X | duration = due_date - start_date |
X | X | start_date = due_date - duration | |
X | duration = datetime.timedelta(days=10) start_date = due_date - duration |
||
X | start_date = datetime.date.today() due_date = start_date + duration |
The date attributes can be managed with timezones. Follow the Python idioms shown in the documentation of datetime
Parameters: |
|
---|
Methods
__init__(**kwargs[, start_date, due_date, ...]) |
Attributes
due_date | The date that the entity should be delivered. |
duration | Duration of the entity. |
start_date | The date that this entity should start. |
The date that the entity should be delivered.
The due_date can be set to a datetime.timedelta and in this case it will be calculated as an offset from the start_date and converted to datetime.date again. Setting the start_date to a date passing the due_date will also set the due_date so the timedelta between them is preserved, default value is 10 days
The date that this entity should start.
Also effects the due_date attribute value in certain conditions, if the start_date is set to a time passing the due_date it will also offset the due_date to keep the duration value fixed. start_date should be an instance of class:datetime.date and the default value is datetime.date.today()
Duration of the entity.
It is a datetime.timedelta instance. Showing the difference of the start_date and the due_date. If edited it changes the due_date attribute value.