This commit is contained in:
John Whitlock 2024-09-16 15:57:13 -05:00
Родитель 3f664499b0
Коммит 3b3371f8f5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 082C735D154FB750
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -117,6 +117,9 @@ class ExpiredRealPhoneManager(models.Manager["RealPhone"]):
)
)
def delete_for_number(self, number: str) -> tuple[int, dict[str, int]]:
return self.filter(number=number).delete()
class RecentRealPhoneManager(models.Manager["RealPhone"]):
"""Return RealPhone records where the sent verification is still valid."""
@ -188,7 +191,7 @@ class RealPhone(models.Model):
# note: it doesn't matter which user is trying to create a new
# RealPhone record - any expired unverified record for the number
# should be deleted
RealPhone.expired_objects.filter(number=self.number).delete()
RealPhone.expired_objects.delete_for_number(self.number)
# We are not ready to support multiple real phone numbers per user,
# so raise an exception if this save() would create a second