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

Add darglint #129

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .darglint

This file was deleted.

4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[flake8]
select = B,B9,C,E,F,N,RST,S,W
select = B,B9,C,DAR,E,F,N,RST,S,W
ignore = E203,E501,W503,C901,S308
max-line-length = 80
max-complexity = 10
docstring-convention = google
per-file-ignores = tests/*:S101
; darglint
strictness = short
5 changes: 1 addition & 4 deletions src/django_sorting_bootstrap/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@


def sort_queryset(queryset, request, context=None):
"""Returns a sorted queryset.

The context argument is only used in the template tag
"""
"""Return a sorted queryset."""
sort_by = request.GET.get("sort_by")
if sort_by:
if sort_by in [el.name for el in queryset.model._meta.fields]:
Expand Down
14 changes: 5 additions & 9 deletions src/django_sorting_bootstrap/templatetags/sorting_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ def sort_headers(context, cl):
return {"cl": cl, "result_headers": headers, "sorted_fields": sorted_fields}


# Usage: {% sort_link "text" "field_name" %}
# Usage: {% sort_link "text" "field_name" "Visible name" %}
def sort_link(context, text, sort_field, visible_name=None):
"""Sorts links.

Usage: {% sort_link "text" "field_name" %}
Usage: {% sort_link "text" "field_name" "Visible name" %}
"""
"""Sort links."""
sorted_fields = False
ascending = None
class_attrib = "sortable"
Expand Down Expand Up @@ -167,12 +165,10 @@ def sort_link(context, text, sort_field, visible_name=None):
)(sort_link)


# Usage: {% auto_sort queryset %}
@register.tag
def auto_sort(parser, token):
"""Auto sort.

Usage: {% auto_sort queryset %}
"""
"""Auto sort."""
try:
tag_name, queryset = token.split_contents()
except ValueError:
Expand Down