Skip to content

Commit 5156c44

Browse files
committed
Fix linting
1 parent b003aa6 commit 5156c44

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

sde_collections/views.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from .forms import CollectionGithubIssueForm, CommentsForm, RequiredUrlForm
2121
from .models.candidate_url import CandidateURL, ResolvedTitle, ResolvedTitleError
22-
from .models.collection import Collection, Comments, RequiredUrls,WorkflowHistory
22+
from .models.collection import Collection, Comments, RequiredUrls, WorkflowHistory
2323
from .models.collection_choice_fields import (
2424
ConnectorChoices,
2525
CurationStatusChoices,
@@ -140,13 +140,17 @@ def get_context_data(self, **kwargs):
140140
)
141141
if "comments_form" not in context:
142142
context["comments_form"] = CommentsForm()
143-
143+
144144
# Initialize a dictionary to hold the most recent history for each workflow status
145145
timeline_history = {}
146-
146+
147147
# Get the most recent history for each workflow status
148-
recent_histories = WorkflowHistory.objects.filter(collection=self.get_object()).order_by('workflow_status', '-created_at').distinct('workflow_status')
149-
148+
recent_histories = (
149+
WorkflowHistory.objects.filter(collection=self.get_object())
150+
.order_by("workflow_status", "-created_at")
151+
.distinct("workflow_status")
152+
)
153+
150154
# Populate the dictionary with the actual history objects
151155
for history in recent_histories:
152156
timeline_history[history.workflow_status] = history
@@ -155,20 +159,23 @@ def get_context_data(self, **kwargs):
155159
for status in WorkflowStatusChoices:
156160
if status not in timeline_history:
157161
timeline_history[status] = {
158-
'workflow_status': status,
159-
'created_at': None,
160-
'label': WorkflowStatusChoices(status).label,
162+
"workflow_status": status,
163+
"created_at": None,
164+
"label": WorkflowStatusChoices(status).label,
161165
}
162-
163-
context['timeline_history'] = [timeline_history[status] for status in WorkflowStatusChoices]
166+
167+
context["timeline_history"] = [timeline_history[status] for status in WorkflowStatusChoices]
164168
context["required_urls"] = RequiredUrls.objects.filter(collection=self.get_object())
165169
context["segment"] = "collection-detail"
166170
context["comments"] = Comments.objects.filter(collection=self.get_object()).order_by("-created_at")
167-
context["workflow_history"] = WorkflowHistory.objects.filter(collection=self.get_object()).order_by('-created_at')
171+
context["workflow_history"] = WorkflowHistory.objects.filter(collection=self.get_object()).order_by(
172+
"-created_at"
173+
)
168174
context["workflow_status_choices"] = WorkflowStatusChoices
169175

170176
return context
171177

178+
172179
class RequiredUrlsDeleteView(LoginRequiredMixin, DeleteView):
173180
model = RequiredUrls
174181

@@ -216,25 +223,22 @@ def get_context_data(self, **kwargs):
216223

217224
return context
218225

219-
class SdeDashboardView(LoginRequiredMixin,ListView ):
220-
226+
227+
class SdeDashboardView(LoginRequiredMixin, ListView):
228+
221229
model = Collection
222230
template_name = "sde_collections/sde_dashboard.html"
223231
context_object_name = "collections"
224232

225233
def get_queryset(self):
226-
return (
227-
super()
228-
.get_queryset()
229-
)
234+
return super().get_queryset()
230235

231236
def get_context_data(self, **kwargs):
232237
context = super().get_context_data(**kwargs)
233238
context["segment"] = "collections"
234239
return context
235240

236241

237-
238242
class CollectionFilterMixin:
239243
def get_queryset(self):
240244
if not self.request.method == "GET":
@@ -387,12 +391,13 @@ class CollectionViewSet(viewsets.ModelViewSet):
387391
queryset = Collection.objects.all()
388392
serializer_class = CollectionSerializer
389393

394+
390395
class CollectionReadViewSet(viewsets.ReadOnlyModelViewSet):
391396
queryset = Collection.objects.all()
392397
serializer_class = CollectionReadSerializer
393398

394399

395-
class PushToGithubView(APIView):
400+
class PushToGithubView(APIView):
396401
def post(self, request):
397402
collection_ids = request.POST.getlist("collection_ids[]", [])
398403
if len(collection_ids) == 0:

0 commit comments

Comments
 (0)