About
The goal of this library is to allow you to inherit an abstract model in your model and turn it into a countdown time with pause and resume capability.
Simply import, inherit and your model is now a timer without worrying about the complexity involved in timekeeping.
This library is written to return the countdown value based on timestamps and thus does not require complicated background tick processes.
Minimum Requirements
Python 3.7
Django 3.0.7
Installation
Run the following in your project.
pip install django-countdowntimer-model
In your settings.p file please add:
INSTALLED_APPS = [
# ...
"countdowntimer_model",
# ...
]
Usage
First you must import the abstraction into your model file.
from countdowntimer_model.models import CountdownTimer
Afterwords your model must inherit the abstraction.
class DoomsdayCountdownTimer(CountdownTimer):
# ...
When you create your model, it is essential you set the duration_in_minutes and state fields. Afterwords the model will handle the rest. Please note if you want to override to use a custom timezone then you can set the timezone_override field.
doomsday_timer = DoomsdayCountdownTimer.object.create(
duration_in_minutes=123,
state=DoomsdayCountdownTimer.STATE.RUNNING,
)
Now that the object has been created you can get the latest countdown by running the following:
remaining_t = doomsday_timer.remaining_time() # // Returned in `time` format.
or
remaining_minutes = doomsday_timer.remaining_time_in_minutes() # // Returned in `integer` format.
License
This library is licensed under the BSD 2-Clause License. See LICENSE for more information.
Metadata
Release files for django-countdowntimer-model 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-countdowntimer-model-0.0.7.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_countdowntimer_model-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / django-countdowntimer-model-0.0.7.tar.gz
| Download URL | django-countdowntimer-model-0.0.7.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6221eac3e26568238b7d5ea284544dae4ad88d8284081243654e2f966689c5d7
|
|
BLAKE2b-256 checksum How to use checksums |
4660d49642d02c804092c448d37441acfce5a85ff61bf6b8695ad953229fda30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
|
Release files / django_countdowntimer_model-0.0.7-py3-none-any.whl
| Download URL | django_countdowntimer_model-0.0.7-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbd902cf41db400243eaa4fb8998bdb43e8b008a77e0f81b9c997d5693628c2d
|
|
BLAKE2b-256 checksum How to use checksums |
5972423cef4ccab987f8a7426f1f777676a27a4627be53dd8583c772cca9a8a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
|