mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
reorganize imports with ruff
This commit is contained in:
@ -25,26 +25,21 @@
|
||||
|
||||
import types
|
||||
|
||||
from sentry_sdk import last_event_id
|
||||
from django.shortcuts import render
|
||||
from django.core.exceptions import (
|
||||
ImproperlyConfigured,
|
||||
PermissionDenied,
|
||||
)
|
||||
from django.http import (
|
||||
HttpResponseForbidden,
|
||||
HttpResponseNotFound,
|
||||
HttpResponseServerError,
|
||||
)
|
||||
from django.template import RequestContext
|
||||
from django.core.exceptions import (
|
||||
PermissionDenied,
|
||||
ObjectDoesNotExist,
|
||||
ImproperlyConfigured,
|
||||
)
|
||||
from django.views.generic.base import View
|
||||
from django.views.generic.edit import FormView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.utils.functional import cached_property
|
||||
from django.db.models import Count
|
||||
from django.views.generic.base import View
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.views.generic.edit import FormView
|
||||
from sentry_sdk import last_event_id
|
||||
|
||||
from core.models import Group
|
||||
from core.views.forms import LoginForm
|
||||
|
||||
|
||||
@ -361,8 +356,8 @@ class DetailFormView(SingleObjectMixin, FormView):
|
||||
return super(DetailFormView, self).get_object()
|
||||
|
||||
|
||||
from .user import *
|
||||
from .page import *
|
||||
from .files import *
|
||||
from .site import *
|
||||
from .group import *
|
||||
from .page import *
|
||||
from .site import *
|
||||
from .user import *
|
||||
|
@ -15,29 +15,28 @@
|
||||
#
|
||||
|
||||
# This file contains all the views that concern the page model
|
||||
from django.shortcuts import redirect, get_object_or_404
|
||||
from django.utils.http import http_date
|
||||
from django.views.generic import ListView, DetailView, TemplateView
|
||||
from django.views.generic.edit import UpdateView, FormMixin, DeleteView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.forms.models import modelform_factory
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.http import Http404, HttpResponse
|
||||
from wsgiref.util import FileWrapper
|
||||
from django.urls import reverse
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django import forms
|
||||
|
||||
import os
|
||||
from wsgiref.util import FileWrapper
|
||||
|
||||
from ajax_select import make_ajax_field
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.forms.models import modelform_factory
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse
|
||||
from django.utils.http import http_date
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DetailView, ListView, TemplateView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.views.generic.edit import DeleteView, FormMixin, UpdateView
|
||||
|
||||
from core.models import SithFile, RealGroup, Notification
|
||||
from core.models import Notification, RealGroup, SithFile
|
||||
from core.views import (
|
||||
CanViewMixin,
|
||||
CanEditMixin,
|
||||
CanEditPropMixin,
|
||||
CanViewMixin,
|
||||
can_view,
|
||||
)
|
||||
from counter.models import Counter
|
||||
|
@ -21,40 +21,37 @@
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
import datetime
|
||||
import re
|
||||
from io import BytesIO
|
||||
|
||||
from ajax_select import make_ajax_field
|
||||
from ajax_select.fields import AutoCompleteSelectField
|
||||
from captcha.fields import CaptchaField
|
||||
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.templatetags.static import static
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import transaction
|
||||
from django.forms import (
|
||||
CheckboxSelectMultiple,
|
||||
Select,
|
||||
DateInput,
|
||||
TextInput,
|
||||
DateTimeInput,
|
||||
Textarea,
|
||||
TextInput,
|
||||
)
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext
|
||||
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
||||
from ajax_select.fields import AutoCompleteSelectField
|
||||
from ajax_select import make_ajax_field
|
||||
from django.utils.dateparse import parse_datetime
|
||||
from django.utils import timezone
|
||||
import datetime
|
||||
from django.forms.utils import to_current_timezone
|
||||
|
||||
import re
|
||||
|
||||
from core.models import User, Page, SithFile, Gift
|
||||
|
||||
from core.utils import resize_image
|
||||
from io import BytesIO
|
||||
from django.templatetags.static import static
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.dateparse import parse_datetime
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
||||
from PIL import Image
|
||||
|
||||
from core.models import Gift, Page, SithFile, User
|
||||
from core.utils import resize_image
|
||||
|
||||
# Widgets
|
||||
|
||||
|
@ -18,15 +18,12 @@
|
||||
This module contains views to manage Groups
|
||||
"""
|
||||
|
||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.edit import FormView
|
||||
from django.urls import reverse_lazy
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django import forms
|
||||
|
||||
from ajax_select.fields import AutoCompleteSelectMultipleField
|
||||
from django import forms
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
|
||||
from core.models import RealGroup, User
|
||||
from core.views import CanCreateMixin, CanEditMixin, DetailFormView
|
||||
|
@ -15,16 +15,16 @@
|
||||
#
|
||||
|
||||
# This file contains all the views that concern the page model
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import ListView, DetailView
|
||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||
from django.forms.models import modelform_factory
|
||||
from django.http import Http404
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import DetailView, ListView
|
||||
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
|
||||
from core.models import Page, PageRev, LockError
|
||||
from core.models import LockError, Page, PageRev
|
||||
from core.views import CanCreateMixin, CanEditMixin, CanEditPropMixin, CanViewMixin
|
||||
from core.views.forms import MarkdownInput, PageForm, PagePropForm
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
|
||||
|
||||
|
||||
class CanEditPagePropMixin(CanEditPropMixin):
|
||||
|
@ -23,23 +23,22 @@
|
||||
#
|
||||
#
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import JsonResponse
|
||||
from django.core import serializers
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils import html
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from django.conf import settings
|
||||
from django.utils.text import slugify
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
import json
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core import serializers
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import redirect, render
|
||||
from django.utils import html
|
||||
from django.utils.text import slugify
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from haystack.query import SearchQuerySet
|
||||
|
||||
from core.models import User, Notification
|
||||
from core.utils import doku_to_markdown, bbcode_to_markdown
|
||||
from club.models import Club
|
||||
from core.models import Notification, User
|
||||
from core.utils import bbcode_to_markdown, doku_to_markdown
|
||||
|
||||
|
||||
def index(request, context=None):
|
||||
|
@ -24,50 +24,49 @@
|
||||
#
|
||||
|
||||
# This file contains all the views that concern the user model
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
import logging
|
||||
from datetime import date, timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import views
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
from django.utils.translation import gettext as _
|
||||
from django.urls import reverse
|
||||
from django.core.exceptions import PermissionDenied, ValidationError
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
from django.forms.models import modelform_factory
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import (
|
||||
ListView,
|
||||
DetailView,
|
||||
TemplateView,
|
||||
CreateView,
|
||||
DeleteView,
|
||||
DetailView,
|
||||
ListView,
|
||||
TemplateView,
|
||||
)
|
||||
from django.forms.models import modelform_factory
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
from django.urls import reverse_lazy
|
||||
from django.template.response import TemplateResponse
|
||||
from django.conf import settings
|
||||
from django.views.generic.dates import YearMixin, MonthMixin
|
||||
from django.views.generic.dates import MonthMixin, YearMixin
|
||||
from django.views.generic.edit import UpdateView
|
||||
|
||||
from datetime import timedelta, date
|
||||
import logging
|
||||
from api.views.sas import all_pictures_of_user
|
||||
|
||||
from core.models import Gift, Preferences, SithFile, User
|
||||
from core.views import (
|
||||
CanViewMixin,
|
||||
CanEditMixin,
|
||||
CanEditPropMixin,
|
||||
UserIsLoggedMixin,
|
||||
TabedViewMixin,
|
||||
CanViewMixin,
|
||||
QuickNotifMixin,
|
||||
TabedViewMixin,
|
||||
UserIsLoggedMixin,
|
||||
)
|
||||
from core.views.forms import (
|
||||
RegisteringForm,
|
||||
UserProfileForm,
|
||||
LoginForm,
|
||||
UserGodfathersForm,
|
||||
GiftForm,
|
||||
LoginForm,
|
||||
RegisteringForm,
|
||||
UserGodfathersForm,
|
||||
UserProfileForm,
|
||||
)
|
||||
from core.models import User, SithFile, Preferences, Gift
|
||||
from subscription.models import Subscription
|
||||
from counter.forms import StudentCardForm
|
||||
from subscription.models import Subscription
|
||||
from trombi.views import UserTrombiForm
|
||||
|
||||
|
||||
@ -501,9 +500,10 @@ class UserStatsView(UserTabsMixin, CanViewMixin, DetailView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(UserStatsView, self).get_context_data(**kwargs)
|
||||
from counter.models import Counter
|
||||
from django.db.models import Sum
|
||||
|
||||
from counter.models import Counter
|
||||
|
||||
foyer = Counter.objects.filter(name="Foyer").first()
|
||||
mde = Counter.objects.filter(name="MDE").first()
|
||||
gommette = Counter.objects.filter(name="La Gommette").first()
|
||||
@ -601,10 +601,12 @@ class UserUploadProfilePictView(CanEditMixin, DetailView):
|
||||
template_name = "core/user_edit.jinja"
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
from core.utils import resize_image
|
||||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from core.utils import resize_image
|
||||
|
||||
self.object = self.get_object()
|
||||
if self.object.profile_pict:
|
||||
raise ValidationError(_("User already has a profile picture"))
|
||||
|
Reference in New Issue
Block a user