Skip to content

Commit

Permalink
Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
RamezIssac committed Oct 6, 2023
1 parent 308a9af commit 86a69d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo_proj/demo_app/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/topics/filter_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 12 additions & 3 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
=====
Expand Down

0 comments on commit 86a69d2

Please sign in to comment.