Skip to main content

django-birthday

https://badge.fury.io/py/django-birthday.svg https://img.shields.io/pypi/pyversions/django-birthday.svg https://img.shields.io/pypi/djversions/django-birthday.svg https://github.com/bashu/django-birthday/actions/workflows/test.yml/badge.svg

django-birthday is a helper library to work with birthdays in models.

Maintained by Basil Shubin (who is available for freelance/contract work), 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.3.1 (2026-11-25)

  • Switched the build backend from setuptools to hatchling and moved the package to a src/ layout; tests now live in a top-level tests/ directory instead of birthday.tests.

  • Converted the test suite from django.test.TestCase to plain pytest functions and fixtures.

  • BirthdayField.contribute_to_class() now accepts and passes through the extra arguments Django may give it, such as private_only.

0.3.0 (2026-10-10)

  • Dropped support for Python < 3.11; 3.11 is now the minimum required version.

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.

Metadata

Release files for django-birthday 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-birthday 0.3.1
File Size Uploaded Provenance Actions
django_birthday-0.3.1.tar.gz 9.5 kB With provenance Details for django_birthday-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-birthday 0.3.1
File Interpreter ABI Platform Actions
django_birthday-0.3.1-py3-none-any.whl Python 3 none any Details for django_birthday-0.3.1-py3-none-any.whl

Total release size: 17.4 kB

Release files / django_birthday-0.3.1.tar.gz

Download URL django_birthday-0.3.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0dc475168edcf8abb7cb2dc8e7bf565a8076229931913a64dc503da449404b37
BLAKE2b-256 checksum
How to use checksums
54ba622e036238eab22bd85ebfebda54b97024fcdebbd7c6066298825a53fc6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / django_birthday-0.3.1-py3-none-any.whl

Download URL django_birthday-0.3.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8b022488b3a3de2b5b9dc06a9239b99a75fa9f602bfd9daff9db78f2f1d8395
BLAKE2b-256 checksum
How to use checksums
74aa9508b6d8c110a69684aaa33fda4b08131e9b252291386343163e517cca5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for django-birthday 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_birthday-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page