This commit is contained in:
zandercymatics 2024-05-03 12:12:17 -06:00
parent 92746e6061
commit 8f60631210
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 4 additions and 3 deletions

View file

@ -7,7 +7,7 @@ from typing import Optional
from django_fsm import FSMField, transition, TransitionNotAllowed # type: ignore from django_fsm import FSMField, transition, TransitionNotAllowed # type: ignore
from django.db import IntegrityError, models from django.db import models
from django.utils import timezone from django.utils import timezone
from typing import Any from typing import Any
from registrar.models.host import Host from registrar.models.host import Host
@ -1967,7 +1967,7 @@ class Domain(TimeStampedModel, DomainHelper):
logger.warning("_get_or_create_public_contact() -> Duplicate contacts found. Deleting duplicate.") logger.warning("_get_or_create_public_contact() -> Duplicate contacts found. Deleting duplicate.")
# Q: Should we be deleting the newest or the oldest? Does it even matter? # Q: Should we be deleting the newest or the oldest? Does it even matter?
oldest_duplicate = db_contact.order_by("created_at").first() oldest_duplicate = db_contact.order_by("created_at")
# Exclude the oldest entry # Exclude the oldest entry
duplicates_to_delete = db_contact.exclude(id=oldest_duplicate.id) duplicates_to_delete = db_contact.exclude(id=oldest_duplicate.id)

View file

@ -21,6 +21,7 @@ class PublicContact(TimeStampedModel):
class Meta: class Meta:
"""Contains meta info about this class""" """Contains meta info about this class"""
# Creates a composite primary key with these fields. # Creates a composite primary key with these fields.
# We can share the same registry id, but only if the contact type is # We can share the same registry id, but only if the contact type is
# different or if the domain is different. # different or if the domain is different.