Skip to content

Commit 2f8a305

Browse files
committed
V0.2.9
- Fix report demo page filter btn - Fix issue with getting the correct verbose_name of a db field.
1 parent 3bb7475 commit 2f8a305

File tree

7 files changed

+17
-7
lines changed

7 files changed

+17
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.2.9] - 2020-10-22
5+
### Updated
6+
- Fixed an issue getting a db field verbose column name
7+
- Fixed an issue with the report demo page's filter button not working correctly.
8+
49
## [0.2.8] - 2020-10-05
510
### Updated
611
- Fixed an error with ManyToOne Relation not being able to

slick_reporting/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
default_app_config = 'slick_reporting.apps.ReportAppConfig'
33

4-
VERSION = (0, 2, 8)
4+
VERSION = (0, 2, 9)
55

6-
__version__ = '0.2.8'
6+
__version__ = '0.2.9'

slick_reporting/form_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_crispy_helper(self, foreign_keys_map=None, crosstab_model=None, **kwargs
5858
helper.form_class = 'form-horizontal'
5959
helper.label_class = 'col-sm-2 col-md-2 col-lg-2'
6060
helper.field_class = 'col-sm-10 col-md-10 col-lg-10'
61-
helper.form_tag = True
61+
helper.form_tag = False
6262
helper.disable_csrf = True
6363
helper.render_unmentioned_fields = True
6464

slick_reporting/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def _parse(self):
416416
f'Field "{col}" not found as an attribute to the generator class, nor as computation field, nor as a database column for the model "{model_to_use._meta.model_name}"')
417417

418418
col_data = {'name': col,
419-
'verbose_name': getattr(attr, 'verbose_name', col),
419+
'verbose_name': getattr(field, 'verbose_name', col),
420420
'source': 'database',
421421
'ref': field,
422422
'type': field.get_internal_type()

tests/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Meta:
1616

1717

1818
class Client(models.Model):
19-
slug = models.CharField(max_length=200, verbose_name=_('Slug'))
19+
slug = models.CharField(max_length=200, verbose_name=_('Client Slug'))
2020

2121
name = models.CharField(max_length=200, verbose_name=_('Name'))
2222
email = models.EmailField(blank=True)

tests/report_generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class GenericGenerator(ReportGenerator):
1313
# we group the sales per client , we display columns slug and title (of the `base_model` defied above
1414
# and we add the magic field `__balance__` we compute the client balance.
1515
group_by = 'client'
16-
columns = ['slug', 'name', '__balance__']
16+
columns = ['slug', 'name']
1717

1818

1919
class GeneratorWithAttrAsColumn(GenericGenerator):

tests/test_generator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from slick_reporting.helpers import get_foreign_keys
99
from .models import OrderLine
1010

11-
from .report_generators import GeneratorWithAttrAsColumn, CrosstabOnClient
11+
from .report_generators import GeneratorWithAttrAsColumn, CrosstabOnClient, GenericGenerator
1212

1313
from .tests import BaseTestData
1414
from .models import SimpleSales
@@ -90,6 +90,11 @@ def test_gather_dependencies_for_time_series(self):
9090

9191
self.assertTrue(report._report_fields_dependencies)
9292

93+
def test_db_field_column_verbose_name(self):
94+
report = GenericGenerator()
95+
field_list = report.get_list_display_columns()
96+
self.assertEqual(field_list[0]['verbose_name'], 'Client Slug')
97+
9398

9499
# test that columns are a straight forward list
95100
class TestReportFields(TestCase):

0 commit comments

Comments
 (0)