Project description
django-birthday is a helper library to work with birthdays in models.
Authored by Jonas Obrist , and some great
contributors .
Installation
pip install django-birthday
Usage
django-birthday provides a birthday.fields.BirthdayField model
field type which is a subclass of django.db.models.DateField and
thus has the same characteristics as that. It also internally adds a
second field to your model holding the day of the year for that
birthday, this is used for the extra functionality exposed by
birthday.managers.BirthdayManager which you should use as the
manager on your model.
A model could look like this:
from django.db import models
from django.conf import settings
from birthday import BirthdayField , BirthdayManager
class UserProfile ( models . Model ):
user = models . ForeignKey ( settings . AUTH_USER_MODEL )
birthday = BirthdayField ()
objects = BirthdayManager ()
Get all user profiles within the next 30 days:
UserProfile . objects . get_upcoming_birthdays ()
Get all user profiles which have their birthday today:
UserProfile . objects . get_birthdays ()
Or order the user profiles according to their birthday:
UserProfile . objects . order_by_birthday ()
For more details, see the documentation at Read The Docs.
License
django-birthday is released under the BSD license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages .
Source Distribution
Built Distribution
File details
Details for the file django-birthday-0.1.4.tar.gz
.
File metadata
Download URL:
django-birthday-0.1.4.tar.gz
Upload date: Oct 10, 2021
Size: 4.8 kB
Tags: Source
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Hashes for django-birthday-0.1.4.tar.gz
Algorithm
Hash digest
SHA256
bab5930be90030208de943cea8bac293309751f1fa95b7b6a0d823bda251ef9a
Copy
MD5
d2dd26a32ac1fdb84a18b5448a70e8b2
Copy
BLAKE2b-256
fceb6ae57952a773da37b2e4eff901cc0b04da6ef9d1548d33db6a7bf63c3d20
Copy
See more details on using hashes here.
File details
Details for the file django_birthday-0.1.4-py3-none-any.whl
.
File metadata
Download URL:
django_birthday-0.1.4-py3-none-any.whl
Upload date: Oct 10, 2021
Size: 7.8 kB
Tags: Python 3
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Hashes for django_birthday-0.1.4-py3-none-any.whl
Algorithm
Hash digest
SHA256
4bdf28a42e37f19f423b530df31b0567bfe8d968591e4ff26533f57b7f5a360d
Copy
MD5
484bd98c00f41138094527acb6f0c1a4
Copy
BLAKE2b-256
b5ebd265ea26a6e53e9201a99cc3d820f983ecd1ba08498fbd8c9cad99cc850b
Copy
See more details on using hashes here.