mirror of
https://github.com/ansible/awx.git
synced 2026-04-09 12:09:20 -02:30
AC-430. Add project status and last_updated as database fields for filtering/sorting.
This commit is contained in:
@@ -245,6 +245,15 @@ class ProjectList(ListCreateAPIView):
|
||||
model = Project
|
||||
serializer_class = ProjectSerializer
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Not optimal, but make sure the project status and last_updated fields
|
||||
# are up to date here...
|
||||
projects_qs = Project.objects.filter(active=True)
|
||||
projects_qs = projects_qs.select_related('current_update', 'last_updated')
|
||||
for project in projects_qs:
|
||||
project.set_status_and_last_updated()
|
||||
return super(ProjectList, self).get(request, *args, **kwargs)
|
||||
|
||||
class ProjectDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
model = Project
|
||||
|
||||
Reference in New Issue
Block a user