def get_field_values_dump() -> str: data = DocumentFieldValue.objects \ .filter(removed_by_user=False, created_by__isnull=False, text_unit__text__isnull=False) \ .annotate(text_unit_text=F('text_unit__text')) \ .values('field_id', 'value', 'extraction_hint', 'text_unit_text', 'created_date', 'modified_date') transfer_objects = [ExternalFieldValue(**i) for i in data] return core_serializers.serialize('json', transfer_objects)
def get_field_values_dump() -> str: import apps.document.repository.document_field_repository as dfr field_repo = dfr.DocumentFieldRepository() data = field_repo.get_annotated_values_for_dump() transfer_objects = [ExternalFieldValue(**i) for i in data] return core_serializers.serialize('json', transfer_objects)