Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit eb4c313

Browse files
author
Thiago C. D'Ávila
authored
Merge pull request #129 from staticdev/add-darglint
Add darglint
2 parents 288f3cf + c92cee5 commit eb4c313

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

.darglint

Lines changed: 0 additions & 2 deletions
This file was deleted.

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[flake8]
2-
select = B,B9,C,E,F,N,RST,S,W
2+
select = B,B9,C,DAR,E,F,N,RST,S,W
33
ignore = E203,E501,W503,C901,S308
44
max-line-length = 80
55
max-complexity = 10
66
docstring-convention = google
77
per-file-ignores = tests/*:S101
8+
; darglint
9+
strictness = short

src/django_sorting_bootstrap/sort.py

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

33

44
def sort_queryset(queryset, request, context=None):
5-
"""Returns a sorted queryset.
6-
7-
The context argument is only used in the template tag
8-
"""
5+
"""Return a sorted queryset."""
96
sort_by = request.GET.get("sort_by")
107
if sort_by:
118
if sort_by in [el.name for el in queryset.model._meta.fields]:

src/django_sorting_bootstrap/templatetags/sorting_tags.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ def sort_headers(context, cl):
9393
return {"cl": cl, "result_headers": headers, "sorted_fields": sorted_fields}
9494

9595

96+
# Usage: {% sort_link "text" "field_name" %}
97+
# Usage: {% sort_link "text" "field_name" "Visible name" %}
9698
def sort_link(context, text, sort_field, visible_name=None):
97-
"""Sorts links.
98-
99-
Usage: {% sort_link "text" "field_name" %}
100-
Usage: {% sort_link "text" "field_name" "Visible name" %}
101-
"""
99+
"""Sort links."""
102100
sorted_fields = False
103101
ascending = None
104102
class_attrib = "sortable"
@@ -167,12 +165,10 @@ def sort_link(context, text, sort_field, visible_name=None):
167165
)(sort_link)
168166

169167

168+
# Usage: {% auto_sort queryset %}
170169
@register.tag
171170
def auto_sort(parser, token):
172-
"""Auto sort.
173-
174-
Usage: {% auto_sort queryset %}
175-
"""
171+
"""Auto sort."""
176172
try:
177173
tag_name, queryset = token.split_contents()
178174
except ValueError:

0 commit comments

Comments
 (0)