Skip to content

Commit

Permalink
V0.2.9
Browse files Browse the repository at this point in the history
- Fix report demo page filter btn
- Fix issue with getting the correct verbose_name of a db field.
  • Loading branch information
RamezIssac committed Oct 22, 2020
1 parent 3bb7475 commit 2f8a305
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.2.9] - 2020-10-22
### Updated
- Fixed an issue getting a db field verbose column name
- Fixed an issue with the report demo page's filter button not working correctly.

## [0.2.8] - 2020-10-05
### Updated
- Fixed an error with ManyToOne Relation not being able to
Expand Down
4 changes: 2 additions & 2 deletions slick_reporting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

default_app_config = 'slick_reporting.apps.ReportAppConfig'

VERSION = (0, 2, 8)
VERSION = (0, 2, 9)

__version__ = '0.2.8'
__version__ = '0.2.9'
2 changes: 1 addition & 1 deletion slick_reporting/form_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_crispy_helper(self, foreign_keys_map=None, crosstab_model=None, **kwargs
helper.form_class = 'form-horizontal'
helper.label_class = 'col-sm-2 col-md-2 col-lg-2'
helper.field_class = 'col-sm-10 col-md-10 col-lg-10'
helper.form_tag = True
helper.form_tag = False
helper.disable_csrf = True
helper.render_unmentioned_fields = True

Expand Down
2 changes: 1 addition & 1 deletion slick_reporting/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _parse(self):
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}"')

col_data = {'name': col,
'verbose_name': getattr(attr, 'verbose_name', col),
'verbose_name': getattr(field, 'verbose_name', col),
'source': 'database',
'ref': field,
'type': field.get_internal_type()
Expand Down
2 changes: 1 addition & 1 deletion tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Meta:


class Client(models.Model):
slug = models.CharField(max_length=200, verbose_name=_('Slug'))
slug = models.CharField(max_length=200, verbose_name=_('Client Slug'))

name = models.CharField(max_length=200, verbose_name=_('Name'))
email = models.EmailField(blank=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/report_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GenericGenerator(ReportGenerator):
# we group the sales per client , we display columns slug and title (of the `base_model` defied above
# and we add the magic field `__balance__` we compute the client balance.
group_by = 'client'
columns = ['slug', 'name', '__balance__']
columns = ['slug', 'name']


class GeneratorWithAttrAsColumn(GenericGenerator):
Expand Down
7 changes: 6 additions & 1 deletion tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from slick_reporting.helpers import get_foreign_keys
from .models import OrderLine

from .report_generators import GeneratorWithAttrAsColumn, CrosstabOnClient
from .report_generators import GeneratorWithAttrAsColumn, CrosstabOnClient, GenericGenerator

from .tests import BaseTestData
from .models import SimpleSales
Expand Down Expand Up @@ -90,6 +90,11 @@ def test_gather_dependencies_for_time_series(self):

self.assertTrue(report._report_fields_dependencies)

def test_db_field_column_verbose_name(self):
report = GenericGenerator()
field_list = report.get_list_display_columns()
self.assertEqual(field_list[0]['verbose_name'], 'Client Slug')


# test that columns are a straight forward list
class TestReportFields(TestCase):
Expand Down

0 comments on commit 2f8a305

Please sign in to comment.