django-birthday is a helper library to work with birthdays in models.
Maintained by Basil Shubin, and some great contributors.
Installation
First install the module, preferably in a virtual environment. It can be installed from PyPI:
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.
Contributing
If you like this module, forked it, or would like to improve it, please let us know! Pull requests are welcome too. :-)
Credits
django-birthday was originally started by Jonas Obrist who has now unfortunately abandoned the project.
License
django-birthday is released under the BSD license.
Changes
0.2.0 (2026-08-14)
Dropped support for Python < 3.10 and Django < 5.2; migrated packaging from setup.py/setup.cfg to pyproject.toml.
Added an automatic post_migrate handler that backfills the cached day-of-year column for pre-existing rows and rows written via bulk_create()/update() whose value was never computed, so BirthdayManager queries are correct without manual intervention (#5).
Fixed the cached day-of-year column being computed from each date’s own actual year, which made it inconsistent for the same calendar day across leap and non-leap years and caused BirthdayManager to silently miss or misorder matching birthdays (#8). Day-of-year is now always computed relative to a fixed reference year, independent of leap status.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_birthday-0.2.0.tar.gz.
File metadata
- Download URL: django_birthday-0.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9467fe92a7b0aafde9dc1a9a98274d038151d1dfec846adc8367cdee28fcd48
|
|
| MD5 |
b9d67d7e5bb88825b96270af7654ab2a
|
|
| BLAKE2b-256 |
b7edb382a9204c59863be0434ca1a50ca135d717d2a73fb18334af2a719b5908
|
Provenance
The following attestation bundles were made for django_birthday-0.2.0.tar.gz:
Publisher:
release.yml on bashu/django-birthday
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_birthday-0.2.0.tar.gz -
Subject digest:
b9467fe92a7b0aafde9dc1a9a98274d038151d1dfec846adc8367cdee28fcd48 - Sigstore transparency entry: 2467336025
- Sigstore integration time:
-
Permalink:
bashu/django-birthday@7204ca22bd3812d88ec9cec41998c60fff4b4025 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/bashu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7204ca22bd3812d88ec9cec41998c60fff4b4025 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_birthday-0.2.0-py3-none-any.whl.
File metadata
- Download URL: django_birthday-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b77c312bef1a5004246a018eebfe9526cbb23a2da48ce060af5c8da67031c5c
|
|
| MD5 |
b7431831c76f1131ba21e75ad7241905
|
|
| BLAKE2b-256 |
375d6303eba7d0421ac61db9f9af81d3b73c97751aaf08a6a2451240fa66ae7a
|
Provenance
The following attestation bundles were made for django_birthday-0.2.0-py3-none-any.whl:
Publisher:
release.yml on bashu/django-birthday
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_birthday-0.2.0-py3-none-any.whl -
Subject digest:
5b77c312bef1a5004246a018eebfe9526cbb23a2da48ce060af5c8da67031c5c - Sigstore transparency entry: 2467336141
- Sigstore integration time:
-
Permalink:
bashu/django-birthday@7204ca22bd3812d88ec9cec41998c60fff4b4025 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/bashu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7204ca22bd3812d88ec9cec41998c60fff4b4025 -
Trigger Event:
push
-
Statement type: