Helper field and manager for working with birthdays
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
import birthday
class UserProfile(models.Model):
user = models.ForeignKey('auth.User')
birthday = birthday.fields.BirthdayField()
objects = birthday.managers.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.
Project details
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.3.tar.gz
.
File metadata
- Download URL: django-birthday-0.1.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 539f1432ec31b7ecfb78184f617d904b498495bf098b9db2f996d0bf92cf4783 |
|
MD5 | d7dc6661086e430eaa629ac37a2deea6 |
|
BLAKE2b-256 | 6d9ab75efb13f90cda7f2641022519d5de6960dd277b42a9a9cde738eca12537 |
File details
Details for the file django_birthday-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: django_birthday-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a66af70c61c90326677eec828098ecf1966b8dc7411921e4c44ab08f033c4071 |
|
MD5 | 78026e6a6585de7dd9ddea01abb96593 |
|
BLAKE2b-256 | 54892631dbce2e828e5e0939f113b3c0ad5e807cd7407173cdefc0400a8a31d4 |