Skip to main content

django-jp-birthday

https://pypi.python.org/pypi/django_jp_birthday image https://img.shields.io:/pypi/djversions/django-jp-birthday https://django-jp-birthday.readthedocs.io/en/latest/?version=latest Updates Python 3 Total alerts https://img.shields.io/github/repo-size/shimakaze-git/django-jp-birthday https://img.shields.io/github/languages/code-size/shimakaze-git/django-jp-birthday https://codecov.io/gh/shimakaze-git/django-jp-birthday/branch/master/graph/badge.svg https://img.shields.io/github/license/shimakaze-git/django-jp-birthday.svg image .github/workflows/test.yml

django-jp-birthday is a django's model for use Japanese birthdays and ages.

Based library is https://github.com/bashu/django-birthday .

Authored by shimakaze_soft and some great

contributors

Features

  • Converting Birthdays to Japanese Style
  • Get all birthdays in the specified Japanese calendar
  • Calculate age based on birthday
  • Get the zodiac
  • Years of the Japanese era

  • Get all user profiles within the next 30 days
  • Get all user profiles which have their birthday today
  • order the user profiles according to their birthday

Installation

$ pip install django-jp-birthday

$ python steup.py install

Usage

django-jp-birthday provides a jp_birthday.models.BirthdayModel model type which is a subclass of django.db.models.Model and thus has the same characteristics as that.

jp_birthday.managers.JpBirthdayManager is used as a manager for jp_birthday.models.BirthdayModel and provides various methods.

from jp_birthday.models import BirthdayModel

class ModelsTest(BirthdayModel):

    class Meta:
        app_label = 'jp_birthday'
        ordering = ('pk',)

Converting Birthdays to Japanese Style

# id: 1
# ["2001-01-01"]

m = ModelTest.objects.filter(id=1).first()
birthday = m.get_jp_era_birthday()
# h-13-1-1

birthday = m.get_jp_era_birthday(True)
# {'era': 'heisei', 'era_short': 'h', 'era_jp': 'へいせい', 'era_kanji': '平成', 'year': 13, 'month': 1, 'day': 1}

Get all birthdays in the specified Japanese calendar

# ["2001-01-01", "2000-01-02", "2002-12-31", "1980-03-01"]

birthdays = ModelTest.objects.get_jp_era_birthdays("heisei")
# ["2001-01-01", "2000-01-02", "2002-12-31"]

birthdays = ModelTest.objects.get_jp_era_birthdays("へいせい")
# ["2001-01-01", "2000-01-02", "2002-12-31"]

Calculate age based on birthday

# id: 1
# ["1995-01-05"]

m = ModelTest.objects.filter(id=1).first()
birthday = m.get_age()
# 27

Get the zodiac

# ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]

# id: 1
# ["1995-01-05"]

m = ModelTest.objects.filter(id=1).first()
birthday = m.get_zodiac()
# 亥

Years of the Japanese era

# id: 1
# ["1995-01-05"]

m = ModelTest.objects.filter(id=1).first()
birthday = m.get_jp_era_years()
# 31

Get all user profiles within the next 30 days

# ["2001-01-01", "2000-01-02", "2002-12-31"]

jan1 = date(year=2010, month=1, day=1)
birthdays = ModelsTest.objects.get_upcoming_birthdays(after=jan1)
# ["2001-01-01", "2000-01-02"]

Get all user profiles which have their birthday today

# ["2001-01-01", "2000-01-02", "2002-12-31", "1990-03-01", "1990-01-01"]

jan1 = date(year=2010, month=1, day=1)
birthdays = ModelsTest.objects.get_birthdays(jan1)

# ["2001-01-01", "1990-01-01"]

Order the user profiles according to their birthday

# ["2001-01-01", "2000-01-02", "2002-12-31", "1990-03-01"]

jan1 = date(year=2010, month=1, day=1)
birthdays = ModelsTest.objects.order_by_birthday()
# ["2001-01-01", "2000-01-02", "1990-03-01", "2002-12-31"]

Docs

License

django-jp-birthday is released under the MIT license.


HISTORY

v0.7.0 (2022-02-09)

Full Changelog

v0.6.0 (2022-02-09)

Full Changelog

Merged pull requests:

v0.4.0 (2022-02-08)

Full Changelog

Merged pull requests:

v0.3.0 (2022-02-07)

Full Changelog

Merged pull requests:

v0.2.0 (2022-02-07)

Full Changelog

Closed issues:

  • Initial Update #30

Merged pull requests:

v0.1.5 (2022-01-29)

Full Changelog

Merged pull requests:

v0.1.4 (2022-01-29)

Full Changelog

Merged pull requests:

v0.1.3 (2022-01-28)

Full Changelog

Merged pull requests:

* This Changelog was automatically generated by github_changelog_generator

Metadata

Release files for django-jp-birthday 0.8.0

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-jp-birthday 0.8.0
File Size Uploaded Provenance Actions
django_jp_birthday-0.8.0.tar.gz 34.5 kB Without provenance Details for django_jp_birthday-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-jp-birthday 0.8.0
File Interpreter ABI Platform Actions
django_jp_birthday-0.8.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_jp_birthday-0.8.0-py2.py3-none-any.whl

Total release size: 47.1 kB

Release files / django_jp_birthday-0.8.0.tar.gz

Download URL django_jp_birthday-0.8.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
29efbef95097eadeba6ff03a934e99e23a753a611738d907684b0fae606bd4b2
BLAKE2b-256 checksum
How to use checksums
ee1798ef687603fdcfa1c0022c4fc1e9e3aa0edd5b2d016f297e1c11cbbdfa8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / django_jp_birthday-0.8.0-py2.py3-none-any.whl

Download URL django_jp_birthday-0.8.0-py2.py3-none-any.whl
Size 12.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
25d368aa4c1f09ebb89544c9f44bef95e58b779c34ee57e851f7b11740feb481
BLAKE2b-256 checksum
How to use checksums
3c8633600bed84262ff76573a4fde03ab3ae492be6e9b33b576c501b099e938d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Security for django-jp-birthday 0.8.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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