Skip to content

Commit 48209c9

Browse files
committed
Fix lints
1 parent af6ab82 commit 48209c9

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

admin/nodes/views.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
import pytz
2-
from enum import Enum
31
from datetime import datetime
4-
from framework import status
2+
from enum import Enum
53

6-
from django.utils import timezone
7-
from django.core.exceptions import PermissionDenied, ValidationError
8-
from django.urls import NoReverseMatch
9-
from django.db.models import F, Case, When, IntegerField
4+
import pytz
105
from django.contrib import messages
116
from django.contrib.auth.mixins import PermissionRequiredMixin
7+
from django.core.exceptions import PermissionDenied, ValidationError
8+
from django.db.models import F, Case, When, IntegerField
129
from django.http import HttpResponse
10+
from django.shortcuts import redirect, reverse, get_object_or_404
11+
from django.urls import NoReverseMatch
12+
from django.urls import reverse_lazy
13+
from django.utils import timezone
1314
from django.views.generic import (
1415
View,
1516
FormView,
1617
ListView,
1718
)
18-
from django.shortcuts import redirect, reverse, get_object_or_404
19-
from django.urls import reverse_lazy
2019

20+
from admin.base.forms import GuidForm
2121
from admin.base.utils import change_embargo_date
2222
from admin.base.views import GuidView
23-
from admin.base.forms import GuidForm
24-
from admin.notifications.views import detect_duplicate_notifications, delete_selected_notifications
2523
from admin.nodes.forms import AddSystemTagForm, RegistrationDateForm
26-
27-
from api.share.utils import update_share
24+
from admin.notifications.views import detect_duplicate_notifications, delete_selected_notifications
2825
from api.caching.tasks import update_storage_usage_cache
29-
26+
from api.share.utils import update_share
27+
from framework import status
3028
from osf.exceptions import NodeStateError, RegistrationStuckError
3129
from osf.models import (
3230
OSFUser,
@@ -49,9 +47,7 @@
4947
REINDEX_ELASTIC,
5048
)
5149
from osf.utils.permissions import ADMIN, API_CONTRIBUTOR_PERMISSIONS
52-
5350
from scripts.approve_registrations import approve_past_pendings
54-
5551
from website import settings, search
5652
from website.archiver.tasks import force_archive
5753

@@ -146,7 +142,8 @@ def get_context_data(self, **kwargs):
146142
'STORAGE_LIMITS': settings.StorageLimits,
147143
'node': node,
148144
# to edit contributors we should have guid as django prohibits _id usage as it starts with an underscore
149-
'annotated_contributors': node.contributor_set.prefetch_related('user__guids').annotate(guid=F('user__guids___id')),
145+
'annotated_contributors': node.contributor_set.prefetch_related('user__guids').annotate(
146+
guid=F('user__guids___id')),
150147
'children': children,
151148
'permissions': API_CONTRIBUTOR_PERMISSIONS,
152149
'has_update_permission': self.request.user.has_perm('osf.change_node'),
@@ -207,7 +204,9 @@ class NodeRemoveContributorView(NodeMixin, View):
207204
def post(self, request, *args, **kwargs):
208205
node = self.get_object()
209206
user = OSFUser.objects.get(id=self.kwargs.get('user_id'))
210-
if node.has_permission(user, ADMIN) and not node._get_admin_contributors_query(node._contributors.all(), require_active=False).exclude(user=user).exists():
207+
if node.has_permission(user, ADMIN) and not node._get_admin_contributors_query(node._contributors.all(),
208+
require_active=False).exclude(
209+
user=user).exists():
211210
messages.error(self.request, 'Must be at least one admin on this node.')
212211
return redirect(self.get_success_url())
213212

@@ -866,7 +865,7 @@ class ForceArchiveRegistrationsView(NodeMixin, View):
866865

867866
def post(self, request, *args, **kwargs):
868867
# Prevents circular imports that cause admin app to hang at startup
869-
from osf.management.commands.force_archive import verify, archive, DEFAULT_PERMISSIBLE_ADDONS
868+
from osf.management.commands.force_archive import verify, DEFAULT_PERMISSIBLE_ADDONS
870869
from osf.models.admin_log_entry import update_admin_log, MANUAL_ARCHIVE_RESTART
871870

872871
registration = self.get_object()
@@ -909,11 +908,12 @@ def post(self, request, *args, **kwargs):
909908
)
910909
messages.success(
911910
request,
912-
f'Registration archive process has started. Task id: {force_archive_task.id}.'
913-
)
911+
f'Registration archive process has started. Task id: {force_archive_task.id}.'
912+
)
914913
except Exception as exc:
915-
messages.error(request, f'This registration cannot be archived due to {exc.__class__.__name__}: {str(exc)}. '
916-
f'If the problem persists get a developer to fix it.')
914+
messages.error(request,
915+
f'This registration cannot be archived due to {exc.__class__.__name__}: {str(exc)}. '
916+
f'If the problem persists get a developer to fix it.')
917917

918918
return redirect(self.get_success_url())
919919

0 commit comments

Comments
 (0)