From dc49edbd7403c91441838754ebca29e73ce5d431 Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Wed, 25 Sep 2019 10:52:12 +0200 Subject: [PATCH] Simplified imports from django.view.generic.* --- src/wiki/plugins/attachments/views.py | 4 +--- src/wiki/plugins/images/views.py | 4 +--- src/wiki/plugins/links/views.py | 2 +- src/wiki/plugins/notifications/views.py | 6 +++--- src/wiki/views/accounts.py | 3 +-- src/wiki/views/article.py | 5 +---- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/wiki/plugins/attachments/views.py b/src/wiki/plugins/attachments/views.py index bfb355f1..a4ae0da2 100644 --- a/src/wiki/plugins/attachments/views.py +++ b/src/wiki/plugins/attachments/views.py @@ -5,9 +5,7 @@ from django.http import Http404, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from django.views.generic.base import TemplateView, View -from django.views.generic.edit import FormView -from django.views.generic.list import ListView +from django.views.generic import FormView, ListView, TemplateView, View from wiki.core.http import send_file from wiki.core.paginator import WikiPaginator from wiki.decorators import get_article, response_forbidden diff --git a/src/wiki/plugins/images/views.py b/src/wiki/plugins/images/views.py index a1e41f32..81144421 100644 --- a/src/wiki/plugins/images/views.py +++ b/src/wiki/plugins/images/views.py @@ -5,9 +5,7 @@ from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from django.views.generic.base import RedirectView -from django.views.generic.edit import FormView -from django.views.generic.list import ListView +from django.views.generic import FormView, ListView, RedirectView from wiki.conf import settings as wiki_settings from wiki.core.paginator import WikiPaginator from wiki.decorators import get_article diff --git a/src/wiki/plugins/links/views.py b/src/wiki/plugins/links/views.py index a155b8db..2ecd6ebe 100644 --- a/src/wiki/plugins/links/views.py +++ b/src/wiki/plugins/links/views.py @@ -1,5 +1,5 @@ from django.utils.decorators import method_decorator -from django.views.generic.base import View +from django.views.generic import View from wiki import models from wiki.core.utils import object_to_json_response from wiki.decorators import get_article diff --git a/src/wiki/plugins/notifications/views.py b/src/wiki/plugins/notifications/views.py index 4c3aaa2f..b4e971b1 100644 --- a/src/wiki/plugins/notifications/views.py +++ b/src/wiki/plugins/notifications/views.py @@ -3,7 +3,7 @@ from django.contrib.auth.decorators import login_required from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from django.views.generic.edit import FormView +from django.views.generic import FormView from . import forms, models @@ -40,12 +40,12 @@ class NotificationSettings(FormView): ).distinct() def get_form_kwargs(self): - kwargs = FormView.get_form_kwargs(self) + kwargs = super().get_form_kwargs(self) kwargs['user'] = self.request.user return kwargs def get_context_data(self, **kwargs): - context = FormView.get_context_data(self, **kwargs) + context = super().get_context_data(self, **kwargs) if 'form' not in context: context['form'] = self.get_form() context['formset'] = context['form'] diff --git a/src/wiki/views/accounts.py b/src/wiki/views/accounts.py index 47333099..2c5d22de 100644 --- a/src/wiki/views/accounts.py +++ b/src/wiki/views/accounts.py @@ -16,8 +16,7 @@ from django.contrib.auth.forms import AuthenticationForm from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from django.utils.translation import gettext as _ -from django.views.generic.base import View -from django.views.generic.edit import CreateView, FormView, UpdateView +from django.views.generic import CreateView, FormView, UpdateView, View from wiki import forms from wiki.conf import settings diff --git a/src/wiki/views/article.py b/src/wiki/views/article.py index db3edb08..a6749152 100644 --- a/src/wiki/views/article.py +++ b/src/wiki/views/article.py @@ -11,11 +11,8 @@ from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext as _, ngettext -from django.views.generic import DetailView -from django.views.generic.base import RedirectView, TemplateView, View -from django.views.generic.edit import FormView -from django.views.generic.list import ListView from django.views.decorators.clickjacking import xframe_options_sameorigin +from django.views.generic import DetailView, FormView, ListView, RedirectView, TemplateView, View from wiki import editors, forms, models from wiki.conf import settings from wiki.core import permissions -- 2.45.2