diff --git a/demo_proj/demo_app/reports.py b/demo_proj/demo_app/reports.py index 048ae4d..cd843bd 100644 --- a/demo_proj/demo_app/reports.py +++ b/demo_proj/demo_app/reports.py @@ -171,7 +171,7 @@ class LastTenSales(ListReportView): report_model = SalesTransaction report_title = "Last 10 sales" date_field = "date" - filters = ["client", "date"] + filters = ["product", "client", "date"] columns = [ "product__name", "client__name", diff --git a/docs/source/topics/filter_form.rst b/docs/source/topics/filter_form.rst index 00bf1a6..6d4b560 100644 --- a/docs/source/topics/filter_form.rst +++ b/docs/source/topics/filter_form.rst @@ -22,7 +22,7 @@ The system expect that the form used with the ``ReportView`` to implement the `` The interface is simple, only 3 mandatory methods to implement, The rest are mandatory only if you are working with a crosstab report or a time series report. -* ``get_filters``: Mandatory, return a tuple (Q_filers , kwargs filter) to be used in filtering. +* ``get_filters``: Mandatory, return a tuple (Q_filters , kwargs filter) to be used in filtering. q_filter: can be none or a series of Django's Q queries kwargs_filter: None or a dictionary of filters diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 020577f..112c612 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -274,9 +274,10 @@ A list report is a report that shows a list of records. For example, if you want report_model = SalesTransaction report_title = "Last 10 sales" date_field = "date" - filters = ["client"] + filters = ["product", "client", "date"] columns = [ - "product", + "product__name", + "client__name", "date", "quantity", "price", @@ -287,6 +288,7 @@ A list report is a report that shows a list of records. For example, if you want + Then again in your urls.py add the following: .. code-block:: python @@ -320,7 +322,7 @@ The system expect that the form used with the ``ReportView`` to implement the `` The interface is simple, only 3 mandatory methods to implement, The rest are mandatory only if you are working with a crosstab report or a time series report. -* ``get_filters``: Mandatory, return a tuple (Q_filers , kwargs filter) to be used in filtering. +* ``get_filters``: Mandatory, return a tuple (Q_filters , kwargs filter) to be used in filtering. q_filter: can be none or a series of Django's Q queries kwargs_filter: None or a dictionary of filters @@ -380,6 +382,13 @@ Example q_filters.append(~Q(product__size__in=["extra_big", "big"])) return q_filters, kw_filters + def get_start_date(self): + return self.cleaned_data["start_date"] + + def get_end_date(self): + return self.cleaned_data["end_date"] + + Recap =====