Package: django-calendardate
A calendar model with date metadata for querying against.Sometimes it is useful to have a range of dates and associated metadata stored in the database, rather than calculating on-the-fly, particularly when creating reports based on quarters, fiscal years, etc. This is where django-calendardate comes in. Also known as a date dimension table or calendar table, the inspiration for this project comes fromthis article.django-calendardate provides:a model for storing metadata about a set of dates.a management command for generating the metadataTHIS PROJECT IS PRE_RELEASE. It works, but is missing documentation and tests. Be cautious.UsageTo process a range of dates (ignoring any duplicates):python manage.py process_dates2021-01-012021-12-31To process a range of dates (overwriting any duplicates):python manage.py process_dates2021-01-012021-12-31--forceOptional settings.py settingsBy default, django-calendardate assumes a fiscal year starts in October. If your fiscal year begins on a different month, setFISCAL_YEAR_START_MONTHto the month number (1-indexed). For instance January would be 1).FISCAL_YEAR_START_MONTH = 1Model FieldsEach of the following are automatically calculated and inserted into the model using theprocess_datesmanagement command.calendar_date(DateField)The actual date objectcalendar_day(PositiveSmallIntegerField)Number from 1 through 31calendar_month(PositiveSmallIntegerField)Month number from 1-12calendar_year(PositiveSmallIntegerField)Current year, eg: 2017, 2025, 1984calendar_quarter(PositiveSmallIntegerField)1-4, indicates quarter within the current yearfiscal_year(PositiveSmallIntegerField)Current fiscal year, eg: 2017, 2025, 1984fiscal_quarter(PositiveSmallIntegerField)1-4, indicates fiscal quarter within the current fiscal yearday_of_week(PositiveSmallIntegerField)Monday is 0 and Sunday is 6day_of_isoweek(PositiveSmallIntegerField)Monday is 1 and Sunday is 7day_of_quarter(PositiveSmallIntegerField)Number from 1-92, indicates the day # in the current quarterday_of_year(PositiveSmallIntegerField)Number from 1-366week_of_month(PositiveSmallIntegerField)Number from 1-6, indicates the number of week within the current monthweek_of_year(PositiveSmallIntegerField)Number from 1-53, indicates the number of week within the current yearisoweek_of_year(PositiveSmallIntegerField)Number from 1-53, indicates the number of isoweek within the current yearis_weekday(BooleanField)True if Monday–>Friday, False for Saturday/Sundayis_leap_year(BooleanField)True if current year is a leap yeardays_in_month(PositiveSmallIntegerField)Number of days in the current monthModel PropertiesEach of the following properties are provided for each date.get_day_name(property)returns a string with the name of the day for the given date (e.g.: “Monday”)get_month_name(property)returns a string with the name of the month for the given date (e.g.: “January”)get_month_abbreviated(property)returns a string with the abbreviated name of the month for the given date (e.g.: “Jan”)Quick Example:Say you have an Order model with aorder_datefield, and you want to query all of the orders that were placed in the third fiscal quarter of fiscal year 2021.# Return list of  of dates in 3rd Qtr of FY21third_fiscal_qtr_dates=CalendarDate.objects.filter(fiscal_year=2021,fiscal_quarter=3).values_list('calendar_date',flat=True)# Filter on those datesthird_qtr_orders=Order.objects.filter(order_date__in=third_fiscal_qtr_dates)To DoTestingBetter documentationTranslations (strings already marked for translation)