All Projects â†’ bashu â†’ django-birthday

bashu / django-birthday

Licence: BSD-3-Clause License
🎂 django-birthday is a helper library to work with birthdays in models

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-birthday

BirthdayReminder
Open source Android application which keeps track of and reminds users of their loved ones birthdays. View on the PlayStore here: https://play.google.com/store/apps/details?id=website.julianrosser.birthdays
Stars: ✭ 29 (+38.1%)
Mutual labels:  birthdays
mango
A @discord bot that has lots of features 🥭
Stars: ✭ 22 (+4.76%)
Mutual labels:  birthdays

django-birthday

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].