mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-21 16:51:08 +02:00
Cleanup
This commit is contained in:
parent
92746e6061
commit
8f60631210
2 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue