Skip to content

Commit

Permalink
Updated super() to new usage in the docs (carltongibson#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreage authored and carltongibson committed Nov 14, 2019
1 parent aa7f7ff commit 805bd07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/guide/tips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ for magic values. This is similar to the ``ChoiceFilter``'s null value handling.

def filter(self, qs, value):
if value != self.empty_value:
return super(MyCharFilter, self).filter(qs, value)
return super().filter(qs, value)

qs = self.get_method(qs)(**{'%s__%s' % (self.name, self.lookup_expr): ""})
return qs.distinct() if self.distinct else qs
Expand Down Expand Up @@ -243,4 +243,4 @@ If defaults are necessary though, the following should mimic the pre-1.0 behavio
if not data.get(name) and initial:
data[name] = initial

super(BaseFilterSet, self).__init__(data, *args, **kwargs)
super().__init__(data, *args, **kwargs)
2 changes: 1 addition & 1 deletion docs/guide/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ those that are published and those that are owned by the logged-in user

@property
def qs(self):
parent = super(ArticleFilter, self).qs
parent = super().qs
author = getattr(self.request, 'user', None)

return parent.filter(is_published=True) \
Expand Down
4 changes: 2 additions & 2 deletions docs/ref/filters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ If you wish to sort by non-model fields, you'll need to add custom handling to a
class CustomOrderingFilter(django_filters.OrderingFilter):

def __init__(self, *args, **kwargs):
super(CustomOrderingFilter, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.extra['choices'] += [
('relevance', 'Relevance'),
('-relevance', 'Relevance (descending)'),
Expand All @@ -827,4 +827,4 @@ If you wish to sort by non-model fields, you'll need to add custom handling to a
# sort queryset by relevance
return ...

return super(CustomOrderingFilter, self).filter(qs, value)
return super().filter(qs, value)

0 comments on commit 805bd07

Please sign in to comment.