Verified Commit 6a2a08ed authored by Elger Jonker's avatar Elger Jonker

Fixes ValueError on organizations feed due to not all scans have associated calculations

parent 1cc0bb62
Pipeline #40013656 passed with stage
in 12 minutes and 31 seconds
......@@ -1807,9 +1807,13 @@ def latest_updates(organization_id):
# semi-union, given not all columns are the same. (not python/django-esque solution)
generic_endpoint_scans = list(EndpointGenericScan.objects.filter(
endpoint__url__organization=organization).order_by('-rating_determined_on')[0:60])
endpoint__url__organization=organization,
type__in=ENDPOINT_SCAN_TYPES
).order_by('-rating_determined_on')[0:60])
url_endpoint_scans = list(UrlGenericScan.objects.filter(
url__organization=organization).order_by('-rating_determined_on')[0:60])
url__organization=organization,
type__in=URL_SCAN_TYPES
).order_by('-rating_determined_on')[0:60])
scans = generic_endpoint_scans + url_endpoint_scans
......@@ -1963,7 +1967,6 @@ def updates_on_organization(request, organization_id):
if not organization_id:
return empty_response()
latest_updates(organization_id)
return JsonResponse(latest_updates(organization_id), encoder=JSEncoder)
......
......@@ -305,6 +305,8 @@ class OrganizationAdmin(ActionMixin, ImportExportModelAdmin, admin.ModelAdmin):
return format_html("<a href='https://www.wikipedia.org/wiki/%s' target='_blank'>🔍 %s</a>" %
(self.wikipedia, self.wikipedia))
# preserve_filters = True
# https://docs.djangoproject.com/en/2.0/ref/forms/validation/
class MyUrlAdminForm(forms.ModelForm):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment