diff --git a/CHANGELOG.md b/CHANGELOG.md index d1ca915..f1d5543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,16 @@ All notable changes to this project will be documented in this file. +## [0.5.5] + +- Add datepicker initialization function call (@squio) +- Fixed an issue with default dates not being functional. + + ## [0.5.4] - Added missing prefix on integrity hash (@squio) - ## [0.5.3] - Enhanced Field prepare flow diff --git a/docs/source/conf.py b/docs/source/conf.py index 416462b..79ac1b2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ master_doc = 'index' # The full version, including alpha/beta/rc tags -release = '0.5.4' +release = '0.5.5' # -- General configuration --------------------------------------------------- diff --git a/slick_reporting/__init__.py b/slick_reporting/__init__.py index 06ed622..8cc8f23 100644 --- a/slick_reporting/__init__.py +++ b/slick_reporting/__init__.py @@ -1,6 +1,6 @@ default_app_config = 'slick_reporting.apps.ReportAppConfig' -VERSION = (0, 5, 4) +VERSION = (0, 5, 5) -__version__ = '0.5.4' +__version__ = '0.5.5' diff --git a/slick_reporting/app_settings.py b/slick_reporting/app_settings.py index e3699fa..2919e23 100644 --- a/slick_reporting/app_settings.py +++ b/slick_reporting/app_settings.py @@ -15,8 +15,18 @@ def get_end_of_this_year(): return datetime.datetime(d.year + 1, 1, 1, 0, 0) -SLICK_REPORTING_DEFAULT_START_DATE = getattr(settings, '', lazy(get_first_of_this_year, datetime.datetime)()) -SLICK_REPORTING_DEFAULT_END_DATE = getattr(settings, '', lazy(get_end_of_this_year, datetime.datetime)()) +def get_start_date(): + start_date = getattr(settings, 'SLICK_REPORTING_DEFAULT_START_DATE', False) + return start_date or get_first_of_this_year() + + +def get_end_date(): + start_date = getattr(settings, 'SLICK_REPORTING_DEFAULT_END_DATE', False) + return start_date or get_end_of_this_year() + + +SLICK_REPORTING_DEFAULT_START_DATE = lazy(get_start_date, datetime.datetime)() +SLICK_REPORTING_DEFAULT_END_DATE = lazy(get_end_date, datetime.datetime)() SLICK_REPORTING_FORM_MEDIA_DEFAULT = { 'css': { diff --git a/tests/tests.py b/tests/tests.py index 2ae2f03..8d0b0f3 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -94,6 +94,12 @@ def test_product_total_sales(self): data = report.get_report_data() self.assertEqual(data[0]['__balance__'], 1800) + @override_settings(SLICK_REPORTING_DEFAULT_START_DATE=datetime.datetime(2020, 1, 1), SLICK_REPORTING_DEFAULT_END_DATE = datetime.datetime(2021, 1, 1)) + def test_product_total_sales_with_changed_dated(self): + report = report_generators.ProductTotalSales() + data = report.get_report_data() + self.assertEqual(len(data), 0) + def test_client_client_sales_monthly(self): report = report_generators.ClientSalesMonthlySeries()