Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

super() new usage in the docs #1147

Merged
merged 3 commits into from
Nov 14, 2019
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
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)