from ncircc.models.notification import Notification def get_incident_notification_mapper() -> dict: """Return mapper with key: value incident_pk: notification_id.""" all_notifications = Notification.objects.select_related('incident').all() mapper = {} for notification in all_notifications: if notification.incident.pk not in mapper: mapper[str(notification.incident.pk)] = notification.pk return mapper