Skip to content
Snippets Groups Projects

GREG-21: Various model updates

Merged Tore.Brede requested to merge GREG-21_test_data_model_updates into master
7 files
+ 268
29
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -42,3 +42,18 @@ class PersonIdentitySerializer(serializers.ModelSerializer):
class Meta:
model = PersonIdentity
fields = "__all__"
def is_duplicate(self, identity_type: str, value: str) -> bool:
# Guests may be verified using another unrecognised identification method,
# which the sponsor is required to elaborate in the value column.
# In this case we cannot assume the union of the identity type and
# the value to be unique across all records.
if identity_type == PersonIdentity.IdentityType.OTHER:
return False
# If the type is a specific ID type, then duplicates are not expected
return (
PersonIdentity.objects.filter(type__like=identity_type)
.filter(value__like=value)
.exists()
)
Loading