Skip to content

Commit a2b92bc

Browse files
committed
Run pre-commit on all files
1 parent e20d2ad commit a2b92bc

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ repos:
1010
- id: check-yaml
1111
- id: debug-statements
1212
- id: end-of-file-fixer
13-
- id: trailing-whitespace
13+
- id: trailing-whitespace

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ To upgrade to `drf_excel` 2.0.0 from `drf_renderer_xlsx`, update your import pat
5656
* `drf_renderer_xlsx.renderers.XLSXRenderer` becomes `drf_excel.renderers.XLSXRenderer`.
5757
* `xlsx_date_format_mappings` has been removed in favor of `column_data_styles` which provides more flexibility
5858

59-
## Configuring Styles
59+
## Configuring Styles
6060

6161
Styles can be added to your worksheet header, column header row, body and column data from view attributes `header`, `column_header`, `body`, `column_data_styles`. Any arguments from [the OpenPyXL package](https://openpyxl.readthedocs.io/en/stable/styles.html) can be used for font, alignment, fill and border_side (border will always be all side of cell).
6262

@@ -148,7 +148,7 @@ def get_header(self):
148148
datetime_format = "%H:%M:%S %d.%m.%Y"
149149
return {
150150
'tab_title': 'MyReport', # title of tab/workbook
151-
'use_header': True, # show the header_title
151+
'use_header': True, # show the header_title
152152
'header_title': 'Report from {} to {}'.format(
153153
start_time.strftime(datetime_format),
154154
end_time.strftime(datetime_format),
@@ -200,7 +200,7 @@ They can be set in the view as a property `sheet_view_options`:
200200
```python
201201
class MyExampleViewSet(serializers.Serializer):
202202
sheet_view_options = {
203-
'rightToLeft': True,
203+
'rightToLeft': True,
204204
'showGridLines': False
205205
}
206206
```
@@ -209,18 +209,18 @@ or using method `get_sheet_view_options`:
209209

210210
```python
211211
class MyExampleViewSet(serializers.Serializer):
212-
212+
213213
def get_sheet_view_options(self):
214214
return {
215-
'rightToLeft': True,
215+
'rightToLeft': True,
216216
'showGridLines': False
217217
}
218218
```
219219
## Controlling XLSX headers and values
220220

221221
### Use Serializer Field labels as header names
222222

223-
By default, headers will use the same 'names' as they are returned by the API. This can be changed by setting `xlsx_use_labels = True` inside your API View.
223+
By default, headers will use the same 'names' as they are returned by the API. This can be changed by setting `xlsx_use_labels = True` inside your API View.
224224

225225
Instead of using the field names, the export will use the labels as they are defined inside your Serializer. A serializer field defined as `title = serializers.CharField(label=_("Some title"))` would return `Some title` instead of `title`, also supporting translations. If no label is set, it will fall back to using `title`.
226226

@@ -248,9 +248,9 @@ DRF_EXCEL_DECIMAL_FORMAT = '0.00E+00'
248248

249249
### Name boolean values
250250

251-
`True` and `False` as values for boolean fields are not always the best representation and don't support translation.
251+
`True` and `False` as values for boolean fields are not always the best representation and don't support translation.
252252

253-
This can be controlled with in you API view with `xlsx_boolean_labels`.
253+
This can be controlled with in you API view with `xlsx_boolean_labels`.
254254

255255
```
256256
xlsx_boolean_labels = {True: _('Yes'), False: _('No')}
@@ -282,7 +282,7 @@ def custom_value_formatter(val):
282282
return val + '!!!'
283283

284284
### Example response:
285-
{
285+
{
286286
results: [
287287
{
288288
title: 'XLSX renderer',

drf_excel/renderers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def _save_virtual_workbook(self, wb):
232232
with TemporaryFile() as tmp:
233233
save_workbook(wb, tmp)
234234
tmp.seek(0)
235-
virtual_workbook = tmp.read()
235+
virtual_workbook = tmp.read()
236236

237237
return virtual_workbook
238238

@@ -380,7 +380,7 @@ def _drf_to_xlsx_field(self, key, value) -> XLSXField:
380380
elif isinstance(field, (IntegerField, FloatField, DecimalField)):
381381
return XLSXNumberField(**kwargs)
382382
elif isinstance(field, (DateTimeField, DateField, TimeField)):
383-
return XLSXDateField(**kwargs)
383+
return XLSXDateField(**kwargs)
384384
elif (
385385
isinstance(field, ListField)
386386
or isinstance(value, Iterable)

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
"rest_framework.renderers.BrowsableAPIRenderer",
2828
"drf_excel.renderers.XLSXRenderer",
2929
),
30-
}
30+
}

tests/test_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
def test_get_setting_not_found():
5-
assert get_setting("INTEGER_FORMAT") is None
5+
assert get_setting("INTEGER_FORMAT") is None

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ deps =
1919
pytest-cov
2020
django-coverage-plugin
2121

22-
commands = {posargs:python -m pytest}
22+
commands = {posargs:python -m pytest}

0 commit comments

Comments
 (0)