diff --git a/apps/tag/web/api/v1/serializers.py b/apps/tag/web/api/v1/serializers.py index fcc910c..487389e 100644 --- a/apps/tag/web/api/v1/serializers.py +++ b/apps/tag/web/api/v1/serializers.py @@ -161,11 +161,12 @@ class TagDistributionSerializer(serializers.ModelSerializer): """ representation = super().to_representation(instance) - representation['batch'] = { - 'id': instance.batch.id, - 'batch_creator': instance.batch.organization.name, - 'batch_identity': instance.batch.batch_identity - } + if instance.batch: + representation['batch'] = { + 'id': instance.batch.id, + 'batch_creator': instance.batch.organization.name, + 'batch_identity': instance.batch.batch_identity + } representation['assigner_org'] = { 'id': instance.assigner_org.id,