1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #23919 -- Replaced super(ClassName, self) with super() in docs.

This commit is contained in:
chillaranand
2017-01-22 12:27:14 +05:30
committed by Tim Graham
parent 2d96c027f5
commit dc165ec8e5
36 changed files with 103 additions and 104 deletions

View File

@@ -131,7 +131,7 @@ MRO is an acronym for Method Resolution Order.
template_name = "home.html"
def get_context_data(self, **kwargs):
context = super(HomePageView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['latest_articles'] = Article.objects.all()[:5]
return context
@@ -194,7 +194,7 @@ MRO is an acronym for Method Resolution Order.
def get_redirect_url(self, *args, **kwargs):
article = get_object_or_404(Article, pk=kwargs['pk'])
article.update_counter()
return super(ArticleCounterRedirectView, self).get_redirect_url(*args, **kwargs)
return super().get_redirect_url(*args, **kwargs)
**Example urls.py**::

View File

@@ -48,7 +48,7 @@ many projects they are typically the most commonly used views.
model = Article
def get_context_data(self, **kwargs):
context = super(ArticleDetailView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['now'] = timezone.now()
return context
@@ -117,7 +117,7 @@ many projects they are typically the most commonly used views.
model = Article
def get_context_data(self, **kwargs):
context = super(ArticleListView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['now'] = timezone.now()
return context

View File

@@ -68,7 +68,7 @@ editing content:
# This method is called when valid form data has been POSTed.
# It should return an HttpResponse.
form.send_email()
return super(ContactView, self).form_valid(form)
return super().form_valid(form)
**Example myapp/contact.html**:

View File

@@ -15,7 +15,7 @@ Simple mixins
arguments provided will make up the returned context. Example usage::
def get_context_data(self, **kwargs):
context = super(RandomNumberView, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['number'] = random.randrange(1, 100)
return context