Skip to main content
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, 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

django_birthday-0.2.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_birthday-0.2.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

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

Hashes for django_birthday-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b9467fe92a7b0aafde9dc1a9a98274d038151d1dfec846adc8367cdee28fcd48
MD5 b9d67d7e5bb88825b96270af7654ab2a
BLAKE2b-256 b7edb382a9204c59863be0434ca1a50ca135d717d2a73fb18334af2a719b5908

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_birthday-0.2.0.tar.gz:

Publisher: release.yml on bashu/django-birthday

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for django_birthday-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b77c312bef1a5004246a018eebfe9526cbb23a2da48ce060af5c8da67031c5c
MD5 b7431831c76f1131ba21e75ad7241905
BLAKE2b-256 375d6303eba7d0421ac61db9f9af81d3b73c97751aaf08a6a2451240fa66ae7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_birthday-0.2.0-py3-none-any.whl:

Publisher: release.yml on bashu/django-birthday

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

1 file

0.1.0

1 file

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